Created
February 26, 2018 19:11
-
-
Save DaveHudson/af9da426b752366c933c6c36cde4b633 to your computer and use it in GitHub Desktop.
Add Service Worker to HTML
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(function (registration) { | |
console.log('Service Worker registration successful with scope: ', registration.scope) | |
}) | |
.catch(function (err) { | |
console.log('Service Worker registration failed: ', err) | |
}) | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment