Chrome 在我的 PWA 中没有显示 "add to homescreen"

Chrome not showing "add to homescreen" in my PWA

我关注了Google的first PWA tutorial and created my own project https://my-pwa-77d8a.firebaseapp.com。一切看起来都很好:

manifest.json

  {
    "short_name": "PizzaApp",
    "name": "My delicious PWA",
    "icons": [
      {
        "src": "img/launcher-icon-2x.png",
        "sizes": "96x96",
        "type": "image/png"
      },
      {
        "src": "img/launcher-icon-3x.png",
        "sizes": "144x144",
        "type": "image/png"
      },
      {
        "src": "img/launcher-icon-4x.png",
        "sizes": "192x192",
        "type": "image/png"
      }
    ],
    "start_url": "/index.html",
    "display": "standalone",
    "orientation": "portrait"
  }

我可以从移动设备和桌面设备手动添加到主屏幕。但是 Chrome 从不显示 添加到主屏幕 横幅。怎么了?

已解决

正如下面指出的,我的服务人员试图缓存丢失的 offline.html 文件。我创建了文件,清除了 phone 的缓存,一切正常。

问题是您的 offline.html 文件 (https://my-pwa-77d8a.firebaseapp.com/offline.html) 返回 404。