diff options
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -22,10 +22,25 @@ <link rel="stylesheet" href="css/styles.css?v=1.0"> <meta name="theme-color" content="#4285f4" /> <link rel="manifest" href="/manifest.webmanifest"> + </head> <body> <h1>WebApp example</h1> - <script src="js/scripts.js"></script> + <script> + // Don't register the service worker + // until the page has fully loaded + window.addEventListener('load', () => { + // Is service worker available? + if ('serviceWorker' in navigator) { + navigator.serviceWorker.register('/service-worker.js').then(() => { + console.log('Service worker registered!'); + }).catch((error) => { + console.warn('Error registering service worker:'); + console.warn(error); + }); + } + }); + </script> </body> </html> |