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

main window name

Status
Not open for further replies.

vlitim76

Programmer
Jun 1, 2006
19
GB
I have a situation where I am using window.open to open a new window and from this window I want to target the opener. Now I can do this using window.opener, but if the user moves the location of the main window to another page and the popup window is moved to a new location on the same site, window.opener no longer works from the popup.

I though that if I named the main window using window.name that I would be able to reference it even if window.opener failed, but I was obviously wrong.

Can anyone help me with this.
 
I believe (not 100% sure) that the following will work.

First, name the opener window with
Code:
window.name = "whatever"

Then in the first popup, grab the name of the opener window with

Code:
window.opener.name
*The above may not be needed, since you already know the window name.

Since the opener window will ALWAYS contain that window name until the window is closed (unless the name gets reassigned), you will have the name of that window in your popup window.

From there, just pass the window name in a hidden form variable to any other locations that the popup window will go to.

Then any reference to that window can be gotten through the .target command.

[small]"I see pretty girls everywhere I look, everywhere I look, everywhere I look. - Band song on movie "The Ringer"[/small]
<.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top