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
content / test / data / hang_before_unload.html [blame]
<html>
<head><title>BeforeUnload dialog</title>
<script>
function clickLink() {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false,
false, false, 0, null);
var target = document.getElementById("link");
target.dispatchEvent(evt);
}
function clickLinkSoon() {
window.setTimeout(clickLink, 100);
return true;
}
window.addEventListener("beforeunload", function(e) {
var confirmationMessage = "foo";
e.returnValue = confirmationMessage;
return confirmationMessage;
});
</script>
</head>
<a href="title2.html" id="link">link</a><br>
</html>