Skip to content

Instantly share code, notes, and snippets.

@deanhume
Last active June 18, 2024 14:26
Show Gist options
  • Save deanhume/ccf1bb609b03a4bcee19 to your computer and use it in GitHub Desktop.
Save deanhume/ccf1bb609b03a4bcee19 to your computer and use it in GitHub Desktop.
Register a Service Worker
<script>
// Register the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.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>
@davidfoto
Copy link

Thnak you for your help.
God Bless You!
https://davidfoto.hu/

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