Source code
Revision control
Copy as Markdown
Other Tools
<!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>