billyo
Jul 18th, 2000, 04:07 AM
Does anybody know of a relatively simple way for a page to discern whether or not the user is merely unloading the page, or if they've "x-ed out" the browser? I'd like to do it without any irritating popup windows, but I can't think of any other way.
Also, do it with the popup window I've tried using something like:
if (window.opener)
{
//okay so this is true in the popup window
}
if (window.opener.location)
{
//this will also be true in a popup window whether or not
//the parent window has been closed.
window.opener.location="http://someurl.com"
//this will cause an error if the parent window has been closed
//so if I could force the error and then trap it it could work
}
So my second question is: how does one trap errors reliably in IE5? The window.onerror=function() seems to call the errorhandling function even when it is the only code in the page, and then it will go on to spew several other errors about "not being implemented" and "expecting some object" etc...
Also, do it with the popup window I've tried using something like:
if (window.opener)
{
//okay so this is true in the popup window
}
if (window.opener.location)
{
//this will also be true in a popup window whether or not
//the parent window has been closed.
window.opener.location="http://someurl.com"
//this will cause an error if the parent window has been closed
//so if I could force the error and then trap it it could work
}
So my second question is: how does one trap errors reliably in IE5? The window.onerror=function() seems to call the errorhandling function even when it is the only code in the page, and then it will go on to spew several other errors about "not being implemented" and "expecting some object" etc...