-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
33 lines (30 loc) · 827 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h1>Hi There!</h1>
<img src="./cat.jpeg" width="300" height="300" />
<script>
async function registerServiceWorker() {
if ("serviceWorker" in navigator) {
try {
const registration = await navigator.serviceWorker.register(
"sw.js"
);
console.log(
"Service Worker registered with scope:",
registration.scope
);
} catch (error) {
console.error("Service Worker registration failed:", error);
}
}
}
registerServiceWorker();
</script>
</body>
</html>