progressive-web-apps - 如何将 PWA start_url 设置为与 manifest.json 文件所在位置不同的位置?
问题描述
如何将start_url
PWA 的 url 设置为与 manifest.json 文件所在位置不同的 url?
所以让我们说start_url
应该是:/a/demo/1/index.html
然后manifest.json
文件位于/storage/demo/1/manifest.json
我将如何正确设置start_url
and scope
?
例如,如果我这样做:
"start_url": "./",
"scope": ".",
然后这将允许您安装 PWA,但是当您加载它时,它会加载一个页面,/storage/demo/1/
显示在此服务器上找不到。
我意识到该解决方案也与设置服务人员范围有关。
但这会导致控制台中出现错误,内容如下:
Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ...: The path of the provided scope ('/a/demo/1/') is not under the max scope allowed ('/storage/demo/1'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.
解决方案
推荐阅读
- angular - 角度下拉值更改所有下拉值
- javascript - toggle-data=collapse 消耗但不关闭
- oracle-apex - Oracle Apex- 美元格式的格式掩码
- antlr - ANTLR:过于贪婪的规则
- python - 可自定义的字符串热图
- php - 使用 nginx / PHP-fpm 的 kubernates 无法正常工作
- database - 拆分名称的正确方法
- java - 如何将字符串列表(斜线分隔值)作为 CSV 发布到 Amazon S3?
- r - 将比较列放入变量中,而不是在 ifelse 语句中完整输入
- php - 如何在 PHP 中为 PDF 添加水印?