closing a popup when the parent closes. 
Author Message
 closing a popup when the parent closes.

I have a page that opens a popup window, the popup is a
frameset whos frames are dynamicly populated based on
various user interactions. One of the first things that
alwase happens is the frameset is replaced with another
framset that compleatly fills the popup window
(location.top).

I need to enforce a buisness rule that if a user closes
the original window (the parent) the popup closes as well.

Normaly I would just have a script in the popup poll for
the existance of the parent, but since there is no one
page that is alwase going to be availible, I am unsure as
to where to place the script. I really don't want to
change any of the frames that are built in the popup, but
that is all I can think of.

So If there is a way to do this from the parent I am all
ears.

Thanks in advance.
Ty



Mon, 07 Mar 2005 02:36:40 GMT  
 closing a popup when the parent closes.
When you open the window using window.open, it returns a "handle"
var xxx = window.open()

onBeforeUnload of your main window call

if (xxx.open)
    xxx.close()

this will close the popup.

Just make sure that you retain the xxx value and don't loose it when
reloading frames.
You could put it in the main frames code (Parent)

Cheers,
Crispin


Quote:
> I have a page that opens a popup window, the popup is a
> frameset whos frames are dynamicly populated based on
> various user interactions. One of the first things that
> alwase happens is the frameset is replaced with another
> framset that compleatly fills the popup window
> (location.top).

> I need to enforce a buisness rule that if a user closes
> the original window (the parent) the popup closes as well.

> Normaly I would just have a script in the popup poll for
> the existance of the parent, but since there is no one
> page that is alwase going to be availible, I am unsure as
> to where to place the script. I really don't want to
> change any of the frames that are built in the popup, but
> that is all I can think of.

> So If there is a way to do this from the parent I am all
> ears.

> Thanks in advance.
> Ty



Mon, 07 Mar 2005 14:57:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Closing a child window when parent closes

2. Close all child windows when parent is closed

3. Close popup closes out altogether

4. Getting a Child window to Refresh its Parent when its closed

5. closing parent window

6. Hell of a Time - Detect Plugins, Close Parent Window, Detect 128 bit Encryption Browser, create Shortcut

7. Opening a New Window and then Closing the Parent HELP

8. To close parent.

9. Updating parent window and closing child window

10. Closing a Parent window

11. Updating parent window and closing child window

12. Updating a parent window and closing the child

 

 
Powered by phpBB® Forum Software