if ("serviceWorker" in navigator) {
// Do a one-off check to see if a service worker's in control.
if (navigator.serviceWorker.controller) {
console.log(
`This page is currently controlled by: ${navigator.serviceWorker.controller}`,
);
} else {
console.log("This page is not currently controlled by a service worker.");
}
} else {
console.log("Service workers are not supported.");
}ServiceWorkerContainer: controller property / notebook
ServiceWorkerContainer: controller property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.