Are PWA sites in same domain not able to install b

2019-06-24 03:17发布

问题:

I created 2 PWA sites
https://s.maplat.jp/r/naramap and https://s.maplat.jp/r/aizumap

But these are not able to install on home screen together.
Once the one installed, the other cannot install.

Are there any specifications or limitations to install PWAs on same domain?

回答1:

You can accomplish this with scoped apps. Update your manifest files to include a scope parameter with a value of the path that "app" should be served under.

"scope": "/r/aizumap/",

and

"scope": "/r/naramap/",

You can still be able to use a single service worker but each sub app will need to have a trailing / in it's path for the start_url/scope to work.

You can see a sample I've made and the source. It has a parent app, and two sub apps.



回答2:

If you have two apps in same domain, map it to two different sub-domain with one service works for each of the sub-domain. That will enable you to host it as a two different PWA and both can be added to home screen.

https://s.maplat.jp/r/naramap -> https://naramap.maplat.jp/r/ 

https://s.maplat.jp/r/aizumap -> https://aizumap.maplat.jp/r/