在Angular10PWA中更新Chrome后,新警告“站点无法安装:页面无法脱机工作。从Chrome93开始…”
Angular 10.2.4 Progressive Web App 通过 HTTPS 在 Apache Tomcat 9.0.41 上提供服务,并且可以离线工作。更新到 Google Chrome 版本 89.0.4389.72(64 位)后,我们在首次加载时在 DevTools 中收到警告:
无法安装站点:页面无法脱机工作。从 Chrome 93 开始,可安装性标准发生变化,此站点将无法安装。有关
更多信息,请参阅https://goo.gle/improved-pwa-offline-detection。
同样在网络选项卡中,我看到两个失败的提取:
| 姓名 | 小路 | 网址 | 地位 | 类型 | 发起人 |
|---|---|---|---|---|---|
| 例子.com | / | https://example.com | (失败)网络:ERR_INTERNET_DISCONNECTED | 拿来 | ngsw-worker.js:2795 |
| ngsw.json?ngsw-cace-bust=0.8890368493450784 | /ngsw.json | https://example.com/ngsw.json?ngsw-cache-bust=0.8890368493450784 | (失败的) | 拿来 | ngsw-worker.js:2795 |
回答
将 'manifest.webmanifest' 中的 'start_url' 更改为 '/index.html' 是我的解决方案(请参阅 Github 上的问题):
"start_url": "/index.html",
DevTools 中的警告不再出现,我仍然可以安装 PWA。在官方修复之前,我将使用此解决方案作为解决方法。
更新 (17/04/2021):Google 刚刚更新了博文并撤回了更改。该警告将在 Google Chrome v90 周围删除。所以我们可以撤消对 Service Worker 的更改(因为 Angular Service Worker 已经离线工作了)。
THE END
二维码