Skip to content

Instantly share code, notes, and snippets.

@evemilano
Created October 25, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evemilano/3c9e606faf98a8a75d0540bf8fe95dd3 to your computer and use it in GitHub Desktop.
Save evemilano/3c9e606faf98a8a75d0540bf8fe95dd3 to your computer and use it in GitHub Desktop.
Service Worker Registration
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}
</script>
@evemilano
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment