October 2017
Intermediate to advanced
302 pages
7h 27m
English
We don't want to register our service worker until the page has finished loading; there's no point, and it can lead to complications, so we'll add an event listener to the window for the 'load' event:
<script> if ('serviceWorker' in navigator) { window.addEventListener('load', function() { }); } else { console.log('service worker is not supported'); }</script>
Read now
Unlock full access