Hi all.
I have 3 pages:
Page 1, the main browser window page of the site
Page 2, a content page that resides in an <IFRAME> on Page 1 (sometimes)
Page 3, a content page that opens in a pop-up window from Page 1 and from Page2
There are links on page3 (popup) that are for the main browser window. SInce sometimes that window's opener is the main window and sometimes the <IFRAME>, I pass a parameter to the popup to tell it who opened it:
?Level=1 (if the IFRAME opened it, no parameter if the main window opened it)
Then there are links in the popup window for the main window (as I've stated already). I handle these links through Javascript:
var tLevel = Number("<%=tLevel%>") //request("level")
if (tLevel == 1)
{window.opener.parent.location.href = "../cand.asp?p=6&chamm=3&by=1"}
else
{window.opener.location.href = "../cand.asp?p=6&chamm=3&by=1"};
So, usually, if the main page opened the popup, the link on the popup will go to the main page
if the Iframe opened the popup, the link on the popup will go to the iframe's parent, the main page.
This usually works okay. But I didn't think of one thing.
If I open the popup window and then navigate the main window off to a different page, that does not contain this IFRAME, the links on the popup no longer function. This is not the case if the popup is launched from the main window links. No matter where I navigate to, the window.opener can still be accessed. It is only when the popup is launched from the IFRAME that the problem can happen.
So, I need a failsafe in this case. How can the popup page reference the window.opener.parent when the window.opener is gone?
By the way, the behavior on this is that the main window will show in the status bar "opening page....." and the progress bar will run out from 0 to 100 and then disappear, but the window will not change location.
Thanks for any suggestions.
Wengang


Reply With Quote