File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Keeping track of other browser windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Keeping track of other browser windows" Watch "Keeping track of other browser windows" New topic

Keeping track of other browser windows

Tim Manchester
Ranch Hand

Joined: Nov 03, 2004
Posts: 62

I have a problem that's got me stumped. First off I'm using I.E. 6 and expect all users to be using the same browser. I start on one page (let's call it the "parent" page). This page has globally defined a method so that it can be called from another page.

I do this in the following way inside <SCRIPT> tags:

In additon, the "parent" page opens a child browser window (let's call it "kiddie") by clicking an html:button opens a child window. Now this child window can call the testPopup method in it's parent pretty easily:

But the problem I have here is that the child browser may navigate to one more page (let's call this page "grandkid"). Here on "grandkid" (the new page) I still need to call the testPopup method on the "parent" page. What I don't have on "grandkid" is a reference to "parent". How do I get one?


Tim Manchester
Tim Manchester
Ranch Hand

Joined: Nov 03, 2004
Posts: 62
Well I found the answer and thought I might as well post it here for folks. It seems that the window.opener variable remains contstant throughout the chain of execution, so in the window "grandkid" you can still call upon window.opener.testPopup(); and it calls all the way back into the "parent" window. Cool.


Tim Manchester
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Also add the note: Once you change the parent window (refresh, close, change page), you loose the reference to the kids.

subject: Keeping track of other browser windows
Similar Threads
Excel Window problem
forwarding parent window
parent window refresh
popup close event
Window.Opener Problem