Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window.Opener Not Working on the Mac

Status
Not open for further replies.

PatrickGreen

Programmer
Mar 11, 2003
35
0
0
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top