-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
54 lines (53 loc) · 2.48 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
<!doctype html>
<html lang="en">
<head>
<link rel="manifest" href="manifest.json" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
/>
</head>
<body style="margin: 0">
<div id="body" style="display: flex; flex-direction: column; height: 100vh; width: 100vw; position: relative">
<div style="width: 100%; height: 64px; background-color: bisque; display: flex; justify-content: center; align-items: center;">
<h1>Instructions</h1>
</div>
<div style="background-color: azure; display: flex; flex-direction: column; align-items: center; flex-grow: 1; padding: 16px">
<ol>
<li>Open this webpage on an <u>iPhone in Safari</u></li>
<li>Open the share options, and click <u>Add to Home Screen</u></li>
<li>Tap on the newly installed version of this app to open it an standalone browser.</li>
<li>Take note of the <u>height in pixels</u></li>
<li>Open the link in the internal browser and then click "Done".</li>
<li>Notice that the height in pixels is <u>less than previous</u>. Also that absolutely positioned footer is not at the bottom of the screen anymore.</li>
</ol>
<br />
<a href="https://example.com" style="font-weight: bold; margin: 4px 0">Open this link then click Done</a>
<br />
<p id="height" style="text-align: center; font-size: large;">The total height of this page is 100vh</p>
<br />
</div>
<div id="footer" style="position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background-color: aquamarine; display: flex; justify-content: center; align-items: center; padding: 16px">
<p>This footer is positioned absolutely at the bottom of the screen.</p>
<p><a href="https://github.com/rileysiemens/safari-pwa-bug" target="_blank">See the code</a></p>
</div>
</div>
<script>
setInterval(() => {
var bodyHeight = document.getElementById('body').getBoundingClientRect().height
document.getElementById('height').innerText = `The total height of this page is 100vh, which equals ${bodyHeight}px`
}, 500)
</script>
<script src="/sw.js"></script>
<script>
// adding a baseline service worker so that this app will be installable
if (!navigator?.serviceWorker?.controller) {
navigator.serviceWorker.register("/sw.js").then(reg => {
console.log('service worker registered', reg)
});
}
</script>
</body>
</html>