How can I use NFC to redirect to or open my Progressive Web App?

前端 未结 2 1833
死守一世寂寞
死守一世寂寞 2020-12-30 18:05

I\'ve got a progressive web app, app.example.com created using Chrome\'s \"Add to Home Screen\" button on Android.

I have an NFC tag that ordinarily op

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-30 18:12

    Can confirm, Android 8, links on other websites or from other apps open the PWA just fine, but the NFC intent opens Chrome. Here is another workaround that doesn't require you to install a native helper APK:

    Create a simple redirect HTML file pwa.html and serve it from a different domain, let's say other.example.com:

    
        
        
    
    

    Then, instead of having the NFC tag point to https://app.example.com, you would program it to point to your redirect HTML https://other.example.com/pwa.html. It's not perfect and really just a workaround, but simpler than building and installing a separate APK.

提交回复
热议问题