forked from paultiarks/SWTest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
41 lines (34 loc) · 961 Bytes
/
index.html
File metadata and controls
41 lines (34 loc) · 961 Bytes
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
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<link rel="canonical" href="https://paultiarks.github.io/SWTest/" />
<style type="text/css">
/* --- application CSS here --- */
* {
background-color: #F5F4F0;
font-family: Georgia, serif;
}
</style>
</head>
<body>
<h1>Content</h1>
<script>
// register ServiceWorker, remember to use absolute path!
if (navigator.serviceWorker) {
navigator.serviceWorker.register('/SWTest/sw.js').then((reg) => {
console.log("registered, scope: " + reg.scope);
})
const messageChannel = new MessageChannel();
navigator.serviceWorker.controller.postMessage({
type: 'INIT_PORT',
}, [messageChannel.port2]);
messageChannel.port1.onmessage = (event) => {
console.log("event: " + event);
};
}
// --- Application code here ---
</script>
<img src="testImage.jpg" width="300" height="168" />
</body>
</html>