...

View Full Version : detecting when window is closed.



ventura
10-16-2003, 07:40 PM
i found this explanation from another board for detecting when a window is closed (not refreshed or switching to another page, but actually closing the browser window). how would i invoke this in the popup that checks the status of the main window?

"Open a small popup off screen to detect for self.opener.closed() if true then the end the session and close the popup."

A1ien51
10-16-2003, 07:47 PM
problem with this is when the page is refresheded the popup looses the parent object so it will think it is closed.

ventura
10-16-2003, 07:49 PM
is this true for when a user just goes to another page also?

ventura
10-16-2003, 07:52 PM
actually, if you refresh, the popup get redrawn, so i think it will work ok. i just need to know how that popup checks the bottom window to see if it's closed or not. do i use a settimeout or something that runs a function that checks it?

glenngv
10-17-2003, 02:51 AM
Is this for IE only?


function doUnload()
{
if ( window.event && window.event.clientX < 0 && window.event.clientY < 0)
{
//the browser is closed
alert("browser closed.");
}
}
...
<body onunload="doUnload()">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum