Forum Moderators: open
I would like to run a server-side script that sends me an email if they choose "OK" (they choose to close the window). Can anyone tell me where to put the code that detects they clicked "OK" and will open a new window to the server-side script BEFORE the original client window closes?
The answer to your question is probably to have the onBeforeUnload event handler return false.
eg.
function someFunction () {
if (somecondition) return false;
return true; // default
} <BODY ... onBeforeUnload="return someFunction();">
I understand that onBeforeUnload is only IE, but that's what 90% of the people out there are using...it's the best I can come up with right now...