closing windows with Javascript

Status
Not open for further replies.

Keyan

Ars Centurion
334
Subscriptor++
From browser "B" you should be able to check "window.opener.closed". It's a boolean value that will return true if the parent window (the one that opened the popup) was closed.

When I tested it, IE 5.5, Netscape 4.75, and Mozilla 0.9.7 worked, however, Opera 5.01 sets "window.opener" to null when the parent window is closed, making it impossible to check "window.opener.closed". So, you'll probably want to do something like this:

code:<HR>
Code:
if (window.opener && !window.opener.closed)
{
   // Parent window is still open
}
else
{
   // Parent window has been closed
}
 
Yes, it works, but I do not understand the meaning of window.opener in the IF structure.
Why I can't check window.opener.closed alone?
If I only check anyotherpopupwindow.closed it works perfectly... only opener seems to need this:

code:<HR>
Code:
if (window.opener && !window.opener.closed)

I can only think of some weird window.opener implementation
 
Status
Not open for further replies.