Multiple PWAs in the same domain

Deadly 提交于 2019-12-22 11:27:17

问题


Is it possible to host multiple PWAs under same endpoint. Say, I have three different PWAs Under root and then root should host these 3 PWAs in such a way that when I switch to any other apps via link or menu it shouldn't open in different window. Currently, it is getting opened in different window as web app whenever, I am clicking on different app.

Thanks, Rahul


回答1:


You may refer with this thread. It stated that 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.

Here's a sample and a source which might also help.




回答2:


You can have multiple PWA when you can

1) Split the app into multiple web app to have one Manifest.json and one service worker for each of them.

2) Host it under different URL

  • Say https://example.com/myFirstApp/ and
  • https://example.com/myOtherApp/ - Place Manifest and SW under each of these path.

You can't have more than one PWA when you have only one Manifest and one SW registered for one path, as these two things essentially defines a unique PWA with a unique scope(URL under which the app is accessible)



来源:https://stackoverflow.com/questions/51280821/multiple-pwas-in-the-same-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!