summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorAlexander Kiryukhin <a.kiryukhin@vk.team>2023-02-16 15:18:56 +0300
committerAlexander Kiryukhin <a.kiryukhin@vk.team>2023-02-16 15:18:56 +0300
commita9a4527af2be6163bb41342e1eb22e93c59b38b4 (patch)
tree8aaaf3e04d1dad144eba193d8495fb1c2fe30c10 /index.html
parent0984eb2a835eb2234bdc61e67039b9e741a0d934 (diff)
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>