1

我正在尝试向我的网站添加一个网络清单,我对它很陌生,所以我刚刚阅读了一个教程并认为我已经完成了,当我测试它时我看到错误“没有检测到匹配的服务工作者。您可能需要重新加载页面,或检查当前页面的服务工作者范围是否包含清单中的范围和起始 URL。” 这对我来说非常困惑,我搜索了互联网并找不到答案。如果你们中的任何人可以帮助我,那就太好了!

清单.网络清单:

    {
    "short_name": "Hi!",
    "name": "Longgg name",
    "icons": [
      {
        "src": "home/icon.png",
        "type": "image/png",
        "sizes": "192x192"
      },
      {
        "src": "home/icon2.png",
        "type": "image/png",
        "sizes": "512x512"
      }
    ],
    "start_url": "https://example.com/home",
    "background_color": "#df4949",
    "display": "standalone",
    "scope": "https://example.com/home",
    "theme_color": "#df4949",
    "shortcuts": [
      {
        "name": "Scroll to top",
        "short_name": "To Top",
        "description": "Scroll to the top of the page!",
        "url": "home#home",
        "icons": [{ "src": "/icons/top.png", "sizes": "192x192" }]
      },
      {
        "name": "Contact Us",
        "short_name": "Contact",
        "description": "Want to get in touch? Contact us for a no-obligation quote!",
        "url": "home#contact-form",
        "icons": [{ "src": "/icons/letter.png", "sizes": "192x192" }]
      }
    ],
    "description": "Description...!",
    "screenshots": [
      {
        "src": "screenshots/1.png",
        "type": "image/png",
        "sizes": "969x1292"
      },
      {
        "src": "screenshots/2.png",
        "type": "image/png",
        "sizes": "969x1292"
      }
    ],
    "prefer_related_applications": false

}

我不知道这是否相关,但这是我参考该文档的方式:

<link rel="manifest" href="/manifest.webmanifest">
4

0 回答 0