blob: 72a1dd256419acf6bcf8ef03286325f809ef7a40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<!DOCTYPE html>
<html>
<head>
<script>
let bc = new BroadcastChannel("test_same_url");
let listener = e => {
switch (e.data) {
case "linkClick":
var link = document.getElementById("link1");
link.click();
break;
case "closeWin":
self.close();
break;
}
};
bc.addEventListener("message", listener);
</script>
</head>
<body onpageshow="bc.postMessage({bodyOnLoad: history.length})">
<a id="link1" href="file_same_url.html">Link 1</a>
<a name="1">link 1</a>
</body>
</html>
|