gecko-dev/dom/serviceworkers/test/thirdparty/unregister.html

20 строки
561 B
HTML

<!DOCTYPE html>
<script>
if (navigator.serviceWorker.controller) {
window.parent.postMessage({status: "controlled"}, "*");
} else {
window.parent.postMessage({status: "uncontrolled"}, "*");
}
navigator.serviceWorker.getRegistration(".").then(function(registration) {
if(!registration) {
return;
}
registration.unregister().then(() => {
window.parent.postMessage({status: "unregistrationdone"}, "*");
});
}).catch(function(e) {
window.parent.postMessage({status: "getregistrationfailed"}, "*");
});
</script>