Created
August 5, 2020 11:23
Include Service worker in your HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Check that service workers are supported | |
if ('serviceWorker' in navigator) { | |
// Use the window load event to keep the page load performant | |
window.addEventListener('load', () => { | |
navigator.serviceWorker.register('/sw.js'); | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment