forked from dicodingacademy/a74-mpwa-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (51 loc) · 1.81 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>News Reader</title>
<meta name="description" content="My first PWA" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="css/materialize.min.css" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#00897B" />
</head>
<body>
<!-- Navigasi -->
<nav class="teal lighten-1" role="navigation">
<div class="nav-wrapper container">
<a href="#" class="brand-logo" id="logo-container">News Reader</a>
<a href="#" class="sidenav-trigger" data-target="nav-mobile">☰</a>
<ul class="topnav right hide-on-med-and-down"></ul>
<ul class="sidenav" id="nav-mobile"></ul>
</div>
</nav>
<!-- Akhir Navigasi -->
<div class="container" id="body-content"></div>
<script src="js/materialize.min.js"></script>
<script src="js/idb.js"></script>
<script src="js/db.js"></script>
<script src="js/nav.js"></script>
<script src="js/api.js"></script>
<script>
// REGISTER SERVICE WORKER
if ("serviceWorker" in navigator) {
window.addEventListener("load", function() {
navigator.serviceWorker
.register("/service-worker.js")
.then(function() {
console.log("Pendaftaran ServiceWorker berhasil");
})
.catch(function() {
console.log("Pendaftaran ServiceWorker gagal");
});
});
} else {
console.log("ServiceWorker belum didukung browser ini.");
}
// REQUEST API UNTUK PERTAMA KALI
document.addEventListener("DOMContentLoaded", function() {
var page = window.location.hash.substr(1);
});
</script>
</body>
</html>