-
Notifications
You must be signed in to change notification settings - Fork 128
/
Copy pathindex.html
129 lines (109 loc) · 3.08 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
html {
font-family: sans-serif;
color-scheme: light dark;
line-height: 1.5;
height: 100dvh;
margin: 0;
place-content: center;
}
body {
background-color: #FFF3C8;
margin: 0 4rem;
display: flex;
gap: 4rem;
flex-direction: column;
align-items: center;
}
form {
padding: 2rem;
background: #0001;
border-radius: .5rem;
display: flex;
flex-wrap: wrap;
column-gap: 1rem;
}
button {
border-radius: .25rem;
border: 0;
background: #0003;
font-weight: bold;
font-size: inherit;
font-family: inherit;
}
button:active {
background: #0005;
}
h1,
p {
margin: 0;
}
#install-link {
margin: 0;
padding: 0;
display: inline;
border: 0;
background: 0;
cursor: pointer;
text-decoration: underline;
font-weight: normal;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #8F6700;
}
}
</style>
<link rel="manifest" href="manifest.json">
<meta name="application-title" content="">
<title>Text from the HTML title element</title>
</head>
<body>
<h1><meta name="application-title"> demo</h1>
<p>
The <code><meta name="application-title" content="..."></code> meta tag allows custom content to
be displayed in the title bar of an installed web application.
<br>
To see a demo, <span id="install-note">first <button id="install-link">install this application</button> and
then</span> use the form below to update the application title shown in
the title bar.
</p>
<form id="update-title">
<label for="title">Change the title bar content</label>
<input id="title" type="text" placeholder="New content to display">
<button type="submit">Change text</button>
</form>
<p>
To learn more, see the <a
href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/DocumentSubtitle/explainer.md"
target="_blank">application-title explainer</a>.
</p>
<script>
const updateForm = document.getElementById("update-title");
const titleBarText = document.getElementById('title');
const appTitleMetaTag = document.querySelector('[name="application-title"]');
const installLink = document.getElementById('install-link');
const installNote = document.getElementById('install-note');
const isInstalled = window.matchMedia('(display-mode: standalone)').matches;
if (!isInstalled) {
window.addEventListener('beforeinstallprompt', e => {
e.preventDefault();
installLink.addEventListener('click', () => {
e.prompt();
});
});
} else {
installNote.style.display = 'none';
}
updateForm.addEventListener("submit", e => {
e.preventDefault();
appTitleMetaTag.setAttribute('content', titleBarText.value);
});
</script>
</body>
</html>