xesite/static/js/installsw.js

8 lines
280 B
JavaScript

if (navigator.serviceWorker.controller) {
console.log("Active service worker found, no need to register");
} else {
navigator.serviceWorker.register("/sw.js").then(function(reg) {
console.log("Service worker has been registered for scope:" + reg.scope);
});
}