Skip to content

Commit 830dad6

Browse files
author
homyakov
committed
Test page for issue stacktracejs#32
1 parent a2410ad commit 830dad6

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

‎test/issues/32.html‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Issue #32</title>
5+
<script src="../../stacktrace.js"></script>
6+
<script>
7+
/*window.onload = function() {
8+
alert("window.onload");
9+
}*/
10+
11+
window.onbeforeunload = function(e) {
12+
e = e || window.event;
13+
// currentTarget originalTarget target
14+
15+
//alert("window.onbeforeunload");
16+
// capture stack trace
17+
// NOTE:
18+
// FF captures full stack,
19+
// IE captures stack but doesn't include 'onbeforeunload' function in stack,
20+
// CHROME doesn't show stack
21+
var trace = printStackTrace();
22+
alert('window.onbeforeunload stacktrace:\n\n' + trace.join('\n\n'));
23+
24+
var msg = 'Do you want to continue window unload?';
25+
// For IE and Firefox prior to version 4
26+
if (e) {
27+
e.returnValue = msg;
28+
}
29+
// For Safari
30+
return msg;
31+
};
32+
</script>
33+
</head>
34+
<body>
35+
To invoke onbeforeunload event:
36+
<ul>
37+
<li>Close the current window.</li>
38+
<li>Navigate to another location by entering a new address or selecting a Favorite.</li>
39+
<li>Click an anchor that refers to another document.</li>
40+
<li>Invoke the anchor.click method.</li>
41+
<li>Invoke the document.write method.</li>
42+
<li>Invoke the document.close method.</li>
43+
<li>Invoke the window.close method.</li>
44+
<li>Invoke the window.navigate or NavigateAndFind method.</li>
45+
<li>Invoke the location.replace method.</li>
46+
<li>Invoke the location.reload method.</li>
47+
<li>Specify a new value for the location.href property.</li>
48+
<li>Submit a form to the address specified in the action attribute via the input type=submit control, or invoke the form.submit method.</li>
49+
<li>Invoke the window.open method, providing the possible value _self for the window name.</li>
50+
<li>Invoke the document.open method.</li>
51+
<li>Click the Back, Forward, Refresh, or Home button.</li>
52+
</ul>
53+
</body>
54+
</html>

0 commit comments

Comments
 (0)