Created
July 15, 2019 17:16
-
-
Save puncoz/d4cd6c7ef1fee69c0f5bbdd8f60af907 to your computer and use it in GitHub Desktop.
Service worker registering in index.html, Backend Knowledge Sharing #8, https://blog.yipl.com.np/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<script> | |
if ("serviceWorker" in navigator) { | |
navigator.serviceWorker.register("/service-worker.js").then((registration) => { | |
console.log("Service worker registered successfully with scope: ", registration.scope) | |
}).catch((error) => { | |
console.error("Service worker registration failed.", error) | |
}) | |
} else { | |
console.info("Your browser does not support the Service-Worker!") | |
} | |
</script> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment