Possible to have multiple `manifest.json` for PWA?

被刻印的时光 ゝ 提交于 2019-12-21 12:34:15

问题


Consider I have:-

  • PWA at myapp.firebaseapp.com with it's own manifest.json.
  • Admin for the PWA at myapp.firebaseapp.com/admin

Is it possible to have another manifest.json for the admin URL to allow "Add to Home Screen" on the same PWA?


回答1:


Sure; the manifest for a given page is determined by the presence of a DOM element with details about the manifest's location.

Assuming you have full control over the HTML for /admin and for all other pages, you can include <link rel="manifest" href="/path/to/admin-manifest.json"> in the HTML for /admin, and <link rel="manifest" href="/path/to/user-manifest.json"> in the HTML for other pages.

Each of the manifests can include, e.g., a different start_url value so that they take the user to a different initial page.




回答2:


Old questions, but I want to add to the conversation in case anyone else gets here via Googling - It's possible to remove the start_url completely from your manifest, and the default behavior should be to open your PWA to whatever page the user was on when he saved the app to the device home screen. This ended up being a better solution in my case, ymmv.



来源:https://stackoverflow.com/questions/46203661/possible-to-have-multiple-manifest-json-for-pwa

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