-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
31 lines (31 loc) · 1000 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Brent J. Kimmel</title>
<link rel="canonical" href="https://bkimmel.github.io/" />
<link rel="manifest" href="/manifest.json">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
</head>
<body>
<h1>Testing Web App Standalone Mode</h1>
<button>Install</button>
<a href="//bkimmel.github.io/svgexperiments">SVG Experiments</a>
<script>
navigator.serviceWorker.register('/worker_standalone.js');
</script>
<script defer>
let deferredPrompt = null;
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
document.querySelector('button').addEventListener('click', ()=>{
deferredPrompt && deferredPrompt.prompt();
deferredPrompt = null;
})
});
</script>
</body>
</html>