未检测到匹配的服务工作者:webapp在子目录中运行

时间:2017-10-18 08:01:59

标签: service-worker

当我尝试添加到主屏幕时,我在控制台中收到了错误信息'

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

注册服务工作人员确实很好,似乎没问题: chrome application-Service Worker

由于我在子域(/ webconnect /)中运行我的网站,因此必须与scop有关:

manifest对于范围和start_url具有以下值:

  

"范围":" / 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!

我是否缺少将该网站添加到主页的特定版本?

1 个答案:

答案 0 :(得分:0)

将服务工作者脚本文件放在网站的根目录(scope),或将其放在任何位置,并使用Service-Worker-Allowed属性和{{1}} HTTP标头,如{ {3}}