Skip to content

Instantly share code, notes, and snippets.

@beebole
Last active July 25, 2017 19:56
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 beebole/26632ca09b5c85da5b4d9b570e490bdc to your computer and use it in GitHub Desktop.
Save beebole/26632ca09b5c85da5b4d9b570e490bdc to your computer and use it in GitHub Desktop.
Mobile offline
if ( 'serviceWorker' in navigator ) {
navigator.serviceWorker.register('sw.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment