navigator.serviceWorker.register("./sw.js", { scope: "/" }).then(
(registration) => {
console.log("Install succeeded, scoped to '/'", registration);
},
(error) => {
console.error(`Service worker registration failed: ${error}`);
},
);Service-Worker-Allowed header / notebook
Service-Worker-Allowed header
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.