-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
34 lines (34 loc) · 1.16 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
<!DOCTYPE html>
<html>
<head>
<!--Set Meta tags-->
<meta charset="UTF-8">
<meta name="description" content="Service worker introductory tutorial">
<meta name="author" content="Tarun Garg">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Service-worker intro</title>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="styles/bootstrap.min.css">
<script type="text/javascript">
//detect if browser supports service worker
if('serviceWorker' in navigator) {
//broswer supports now register it
navigator.serviceWorker
.register('service-worker.js') //Note that we have not passed scope object here now by default it will pick root scope
.then(function() {
console.log('Service Worker Registered');
})
.catch(function(err) {
console.error(err);
})
} else {
console.log("Ahh! Your browser does not supports serviceWorker");
}
</script>
</head>
<body>
<div class="container">
Hello world!
</div>
</body>
</html>