Skip to content

Instantly share code, notes, and snippets.

@thangman22
Created July 22, 2016 05:29
Show Gist options
  • Save thangman22/8c1f9fe98d40179b23eb7378620ada5d to your computer and use it in GitHub Desktop.
Save thangman22/8c1f9fe98d40179b23eb7378620ada5d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
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);
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment