Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么卸载 #12

Closed
xiaokuqwq opened this issue Oct 1, 2022 · 4 comments
Closed

怎么卸载 #12

xiaokuqwq opened this issue Oct 1, 2022 · 4 comments

Comments

@xiaokuqwq
Copy link

No description provided.

@ChenYFan
Copy link
Owner

和普通sw卸载方式一样:
1.不要删除cw.js
2.将安装代码替换为卸载代码

@1834423612
Copy link

请问卸载代码是啥?现在在我网站里面关不掉了,安装也安不上,关也关不掉 :(

@ChenYFan
Copy link
Owner

请问卸载代码是啥?现在在我网站里面关不掉了,安装也安不上,关也关不掉 :(

...这东西不应该在本地测试好在上生产吗...

移除cw和移除sw一样,请不要直接删掉cw.js和安装代码,如果已删除请将原文件复原,并将安装代码改成:

navigator.serviceWorker.getRegistrations().then(function(registrations) {
 for(let registration of registrations) {
  registration.unregister()
} })

在足够长的一段时间后才能移除js文件,否则很有可能有一部分访客没能获得卸载代码导致无法卸载也无法更新。

@1834423612
Copy link

请问卸载代码是啥?现在在我网站里面关不掉了,安装也安不上,关也关不掉 :(

...这东西不应该在本地测试好在上生产吗...

移除cw和移除sw一样,请不要直接删掉cw.js和安装代码,如果已删除请将原文件复原,并将安装代码改成:

navigator.serviceWorker.getRegistrations().then(function(registrations) {
 for(let registration of registrations) {
  registration.unregister()
} })

在足够长的一段时间后才能移除js文件,否则很有可能有一部分访客没能获得卸载代码导致无法卸载也无法更新。

好的,谢谢😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants