[英]PWA service worker updated at every refresh
I'm registering service worker with the following updated callback:我正在使用以下更新的回调注册服务工作者:
updated() {
alert('An update is ready. Please refresh the page.')
},
I make a minor change to the content of service-worker.js
file to the browsers detect the change.我对
service-worker.js
文件的内容做了一个小改动,以便浏览器检测到更改。
const version = 3.7;
When I deploy it I successfully get the updated alert but when I refresh I get it again.当我部署它时,我成功地获得了更新的警报,但是当我刷新时,我又得到了它。 However I receive the new changes but I still get this alert which is not necessary anymore.
但是我收到了新的更改,但我仍然收到不再需要的警报。
This code fixed the problem此代码解决了问题
self.addEventListener('install', function(event) {
self.skipWaiting();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.