OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 |
| 3 <head><title>BeforeUnload dialog</title> |
| 4 <script> |
| 5 function clickLink() { |
| 6 var evt = document.createEvent("MouseEvents"); |
| 7 evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, fals
e, |
| 8 false, false, 0, null); |
| 9 var target = document.getElementById("link"); |
| 10 target.dispatchEvent(evt); |
| 11 } |
| 12 |
| 13 function clickLinkSoon() { |
| 14 window.setTimeout(clickLink, 100); |
| 15 return true; |
| 16 } |
| 17 |
| 18 window.addEventListener("beforeunload", function(e) { |
| 19 var confirmationMessage = "foo"; |
| 20 e.returnValue = confirmationMessage; |
| 21 return confirmationMessage; |
| 22 }); |
| 23 |
| 24 </script> |
| 25 </head> |
| 26 |
| 27 <a href="title2.html" id="link">link</a><br> |
| 28 |
| 29 </html> |
OLD | NEW |