Skip to content

Instantly share code, notes, and snippets.

@barna2019
Created June 24, 2020 12:29
Show Gist options
  • Save barna2019/4e117fb9d062318d05ce5def429a21db to your computer and use it in GitHub Desktop.
Save barna2019/4e117fb9d062318d05ce5def429a21db to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>installing service worker</title>
<script type="text/javascript">
var swsource = "https://gist.githubusercontent.com/barna2019/e9c2d4d2e1548f52b08304ef69bce2eb/raw/bcad9d0b8f938c05e3d508663d02f4dd6e196667/serviceworker.js";
if("serviceWorker" in navigator) {
navigator.serviceWorker.register(swsource).then(function(reg){
console.log('ServiceWorker scope: ', reg.scope);
}).catch(function(err) {
console.log('ServiceWorker registration failed: ', err);
});
};
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment