I'm looking at a script that is supposed to 'logout' a user if the user 'closes' the browser or navigates away from the site.
The relevant code is show below (IP and site details edited to protect the innocent!!)
There is also an error handler shown in the second code block, which calls the close.asp. This is supposed to be called when the user has navigated to any sites where the an error is generated when attempting to access the host info.
Neither closing the current window nor navigating to another site calls script that closes the session. Has anyone any suggestions, I seem to get different results each time I run this.
TIA
JOB
The code below occurs in the <BODY> block.
code below is before the <HTML> tag
The relevant code is show below (IP and site details edited to protect the innocent!!)
There is also an error handler shown in the second code block, which calls the close.asp. This is supposed to be called when the user has navigated to any sites where the an error is generated when attempting to access the host info.
Neither closing the current window nor navigating to another site calls script that closes the session. Has anyone any suggestions, I seem to get different results each time I run this.
TIA
JOB
The code below occurs in the <BODY> block.
Code:
onerror = handleError;
if( (opener.closed == true) ||((opener.top.location.host != 'my_first_site') && (opener.top.location.host != 'my_second_site') && (opener.top.location.host != '99.999.999.99') && (opener.top.location.host != '88.888.88.88')) {
alert('opener moved No Error - Redirect to Close.asp')
top.location = 'Close.asp'
}
else {
alert('Body No Error - Close Window')
top.close()
}
code below is before the <HTML> tag
Code:
if(opener.closed != true)
{
opener.focus;
}
function handleError()
{
top.location = 'Close.asp';
return true;
}