Entry
How can I capture the window.close() event other then ONUNLOAD?
Feb 19th, 2006 11:09
Alex Cohn, Adam Baruch,
You can add two lines to your script:
function window_close() { alert("I shall not close"); }
window.close = window_close;
Now call to window.close() will show the new alert. You can store the
original function aside, e.g.
var backup = new Object(); backup.close = window.close;
(naturally, you do that before you reassign window.close). Now you can
perform all your verification and call the orignal function to close the
window.