-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (34 loc) · 823 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
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<title>Page Visiblity Bug Sample</title>
<style>
.root {
width: 100%;
margin: 2rem 0;
}
.event-log {
width: 100%;
text-align: center;
margin: 0.5rem;
}
</style>
<script>
function addElement() {
var test = document.querySelector(".root");
var newDiv = document.createElement("div");
newDiv.classList.add("event-log");
newDiv.innerText =
"EVENT FIRED - DOCUMENT " +
document.visibilityState.toUpperCase() +
" " +
new Date().toLocaleTimeString();
test.appendChild(newDiv);
}
document.addEventListener("visibilitychange", addElement);
</script>
</head>
<body>
<div class="root"></div>
</body>
</html>