gpt4 book ai didi

service-worker - 未检测到匹配的服务 worker : webapp running in sub-directory

转载 作者:行者123 更新时间:2023-12-04 13:23:03 24 4
gpt4 key购买 nike

当我尝试“添加到主屏幕”时,我在控制台中收到以下错误消息

Site cannot be installed: no matching service worker detected. You may need to reload the page, or check that the service worker for the current page also controls the start URL from the manifest

注册 service-worker 确实很顺利,似乎没问题: chrome application-Service Worker

这一定与范围有关,因为我在子域 (/webconnect/) 中运行我的站点:

manifest范围和 start_url 具有以下值:

"scope": "/webconnect/"

"start_url": "/webconnect/index.html"

我已经完成了故障排除部分,但这对我没有太大帮助:

Troubleshooting

If after testing you are getting the following error in your console:

No matching service worker detected. You may need to reload the page, or check that the service worker for the current page also controls the start URL from the manifest
Then please make sure that 1. Your service worker is functioning properly and without errors, and 2. Your start_url matches an actual url of your website that loads. Else, you will never get the prompt to show!

是否缺少将网站添加到主页的特定技巧?

最佳答案

将 service worker 脚本文件放在您网站的根目录 (/webconnect/),或者将它放在您想要的任何位置并使用 scope 属性和 Service-Worker-Allowed HTTP header ,如 my other answer .

关于service-worker - 未检测到匹配的服务 worker : webapp running in sub-directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46805396/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com