我如何卸载服务工作者? [英] How do I uninstall a Service Worker?
问题描述
从我的根目录中删除 /serviceworker.js
后,Chrome仍会运行从我的webroot中移除的服务工作人员。我如何从我的网站和Chrome卸载服务工作人员,以便我可以重新登录到我的网站?
我已经将问题跟踪到了Service Work的缓存机制,只是想现在删除,直到我有时间调试它。我使用的登录脚本重定向到Google的服务器,以便他们登录到他们的Google帐户。但是我从login.php页面得到的是 ERR_FAILED
消息。
您可以像这样以编程方式移除服务工作者:
<$ p $ ($注册注册){
registration.unregister()
}}(函数(注册){
) )
文档: getRegistrations ,取消注册
您也可以在Chrome Devtools的应用程序选项卡下删除服务人员。
After deleting /serviceworker.js
from my root directory, Chrome still runs the service worker that I removed from my webroot. How do I uninstall the service worker from my website and Chrome so I can log back into my website?
I've tracked the issue down to Service Work's cache mechanism and I just want to remove for now until I have time to debug it. The login script that I'm using redirects to Google's servers for them to login to their Google account. But all I get from the login.php page is an ERR_FAILED
message.
You can remove service workers programmatically like this:
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for(let registration of registrations) {
registration.unregister()
} })
Docs: getRegistrations, unregister
You can also remove service workers under the Application tab in Chrome Devtools.
这篇关于我如何卸载服务工作者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!