is there a way to know if the client has closed the window I opened for him with the X at the top right corner?
I have a close button because I need to do something on close so if the user closed the window with the X button
I'll still catch it.
Thanks
Guy
closing window
Moderator: General Moderators
Here you are:
Code: Select all
<BODY onOnload="javascript:alert('user closed')">That should be :
Code: Select all
<BODY onUnLoad="javascript:alert('user closed')">
Last edited by Wayne on Wed May 14, 2003 5:31 am, edited 1 time in total.
not quite yet
this is a very simple script that will work
the JavaScript event handler is onUnLoad
do what ever you want in the function.
phpScott
ps. It works for IE but not NetScape 7 at least.
If the client closes the browser this script doen't fire but if they close the tab it will.
the JavaScript event handler is onUnLoad
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script script language="JavaScript">
function ThewindowIsBeingClosed()
{ window.open("http://cnn.com");
}
</script>
</head>
<body onunload=ThewindowIsBeingClosed()>
</body>
</html>phpScott
ps. It works for IE but not NetScape 7 at least.
If the client closes the browser this script doen't fire but if they close the tab it will.
Sorry Typo
OnUnLoad
OnUnLoad
[/b][]InTeR[] wrote:Here you are:Code: Select all
<BODY onUnload="javascript:alert('user closed')">
