PatrickGreen
Programmer
To All:
On my window_beforeunload, I fire an event which opens a new window and runs the following code to determine if the user is leaving my site:
function CheckStatus()
{
try
{
var mystring = new String(window.opener.location.href);
mystring = mystring.toLowerCase();
if(mystring.indexOf("WebsiteName"
!= -1 {
alert("logoff"
;
window.location.replace("logoff.asp?GUID=" + GUID + "&UserID=" + UserID);
}
else
{
if (window.opener && !window.opener.closed)
{
self.close();
}
else
{
alert("logoff"
;
window.location.replace("logoff.asp?GUID=" + GUID + "&UserID=" + UserID);
}
}
}
catch(err)
{
alert(err.message);
window.location.replace("logoff.asp?GUID=" + GUID + "&UserID=" + UserID);
}
}
This works great in windows environment for both Netsape 6+ and IE 5.5+. But on the Mac, when a page is refreshed or the browser is closed, window.opener becomes null and then always causes an error. So I have created a function for the mac which uses window.parent, but window.parent.closed is always false (microsfot bug) and window.parent.location.href, is always the page I am on. Is there any way on the mac to determine correctly if the window that opened the child is still open or still in the domain?
Thanks For Your Help,
Patrick
On my window_beforeunload, I fire an event which opens a new window and runs the following code to determine if the user is leaving my site:
function CheckStatus()
{
try
{
var mystring = new String(window.opener.location.href);
mystring = mystring.toLowerCase();
if(mystring.indexOf("WebsiteName"
alert("logoff"
window.location.replace("logoff.asp?GUID=" + GUID + "&UserID=" + UserID);
}
else
{
if (window.opener && !window.opener.closed)
{
self.close();
}
else
{
alert("logoff"
window.location.replace("logoff.asp?GUID=" + GUID + "&UserID=" + UserID);
}
}
}
catch(err)
{
alert(err.message);
window.location.replace("logoff.asp?GUID=" + GUID + "&UserID=" + UserID);
}
}
This works great in windows environment for both Netsape 6+ and IE 5.5+. But on the Mac, when a page is refreshed or the browser is closed, window.opener becomes null and then always causes an error. So I have created a function for the mac which uses window.parent, but window.parent.closed is always false (microsfot bug) and window.parent.location.href, is always the page I am on. Is there any way on the mac to determine correctly if the window that opened the child is still open or still in the domain?
Thanks For Your Help,
Patrick