summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-rw-r--r--index.html17
1 files changed, 16 insertions, 1 deletions
diff --git a/index.html b/index.html
index 4fee029..d00638e 100644
--- a/index.html
+++ b/index.html
@@ -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>