我想使用以下 JS 代码从我的网站取消注册 service-worker:
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for(let registration of registrations) {
if (registration.active.scriptURL === 'https://myapp.mydomain.com/siteworker-sw.js') {
registration.unregister();
}
}
});
虽然这在 Chrome 中运行正常,但 IE 11 会引发错误
';' expected
有人可以指出我正确的方向吗?
最佳答案
自 it's not supported in IE 起,您的 for..of
语句就被轰炸了。 .
关于javascript - 在 IE 中取消注册(特定)serviceworker 失败,而代码在 Chrome 中正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53950731/