【问题标题】:No matching service worker detected: webapp running in sub-directory未检测到匹配的服务人员:webapp 在子目录中运行
【发布时间】:2017-10-18 08:01:58
【问题描述】:

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

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 的 scope 和 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!

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

【问题讨论】:

    标签: service-worker


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-12-16
      • 2020-05-13
      • 2020-11-20
      • 2020-06-04
      • 2018-01-14
      • 1970-01-01
      • 1970-01-01
      • 2021-05-14
      • 2020-05-30
      相关资源
      最近更新 更多