Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 | |
| 3 <head><title>Possible BeforeUnload</title> | |
| 4 <script> | |
| 5 function clickLink() { | |
| 6 var evt = document.createEvent("MouseEvents"); | |
| 7 evt.initMouseEvent("click", true, true, window, | |
| 8 0, 0, 0, 0, 0, false, false, | |
| 9 false, false, 0, null); | |
| 10 var target = document.getElementById("link"); | |
| 11 target.dispatchEvent(evt); | |
| 12 } | |
| 13 | |
| 14 function clickLinkSoon() { | |
| 15 window.setTimeout(clickLink, 100); | |
|
clamy
2016/03/22 16:33:46
The browser will hang in BeforeUnload, so I can't
| |
| 16 return true; | |
| 17 } | |
| 18 | |
| 19 window.addEventListener("beforeunload", function(e){ | |
| 20 var confirmationMessage = "foo"; | |
| 21 e.returnValue = confirmationMessage; | |
| 22 return confirmationMessage; | |
| 23 }); | |
| 24 | |
| 25 </script> | |
| 26 </head> | |
| 27 | |
| 28 <a href="title2.html" id="link">link</a><br> | |
| 29 | |
| 30 </html> | |
| OLD | NEW |