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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing window references between windows

Status
Not open for further replies.

digijin

Programmer
Joined
Feb 15, 2006
Messages
5
Location
AU
Hi guys,

I've got a client that wants a site where they will have an opening page, and when you launch the site it launches 4 popup windows (1 navigation, 3 content)

anyway I can launch them easy enough with window.open, but the client wants it so that if you close any of the 4 windows, all 4 close. I can make the opening page monitor the 4 popups and close the remaining popups if it finds any have been closed, but I cant be sure the opening window itself will not be closed after the site is launched.

What I want to do, is get the opening window to pass the references of all the windows it has opened to all the windows (does that make sense?) so the navigation window will be passed the references to the other 3 content windows that were opened, so that onUnload it can close() them.

Or if theres any other way to reference windows from a page other than the one that opened it please let me know,

thanks for your time,

James
 
The best way forward is to have a common close routine (included in a JS file).

This routine would open all 4 windows again (with a blank page) with the same names as when first opened, grab the handles to them, and close them.

I'd say this is by far the easiest, safest, and most reliable way to do it.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
wow I'd just thought up a way along the lines of putting

video = opener.video;
content1 = opener.content1;
content2 = opener.content2;
function closeOthers(){
video.close();
content1.close();
content2.close();
}

in the head of each page, but replacing the windows to grab the windows seems like a much better idea

to my rescue again billyray/dan!

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top