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

Help me resolve this javascript nuance

Status
Not open for further replies.

corpsinhere

Technical User
Feb 15, 2000
23
US
The site has two frames, Alpha(not important) and <b>Beta</b>.<br>A link on frame <b>Beta</b> changes the page loaded into <b>Beta</b> and calls popup window <b>Gamma</b>.<br>The popup window <b>Gamma</b> runs a script that asks if you want to leave the frame.<br>A &quot;yes&quot; response runs a function which loads the site currently in <b>Beta</b> into the main window (suplanting the frameset URL).<br>And here is the problem - I have tried to access the new URL loaded in <b>Beta</b> using <br><br>opener.location.href(results in access denied) and using <br><br>top.Beta.location.href(resulting in the URL of the popup <b>Gamma</b>).<br><br>I have &quot;fixed&quot; the problem by just putting the URL that the link originally called into the function on Gamma. But I want to use this escape-the-frame popup on many links which call different URLs. Right now I have to have a different HTML file for each instance - quite a drag. Any help would be appreciated.
 
in the popup window (gamma):<br><br>document.parent = the window that opened gamma (beta, I think)<br><br>document.parent.top = the main window (lets call it Omega}<br><br>so...<br><br>document.parent.top.location.replace(document.parent.location);<br><br>but if that dosn't work, try:<br><br>document.parent.top.location.replace(document.parent.top.beta.location);<br><br>hope this helped <p>theEclipse<br><a href=mailto:eclipse_web@hotmail.com>eclipse_web@hotmail.com</a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>**-Trying to build a documentation of a Javascript DOM, crossbrowser, of course. E-mail me if you know of any little known events and/or methods, etc.
 
Thanks theEclipse (see previous response), but no go, unfortunately. I set up some document.writes to see what is going on and have come across a curiosity (for me at least).<br><br>All the following document.writes are called from the popup window Gamma. Gamma is called from link from Beta, a frame in Omega. Note that the link in Beta which calls Gamma also changes the URL displayed in Beta. (whew! lots o' Greek letters!) : <br><br><b>window.self.document.location.href results in</b><br><font color=red>htp://ww.omega.com/gamma</font><br>That's ok as Gamma is the document that calls the document.write and Gamma is also inside the fameset document omega<br><br><b>window.self.parent.top.document.location.href results in</b><br><font color=red>htp://ww.omega.com/gamma</font><br>That is also ok as gamma is a popup and not part of a frameset.<br><br><b>window.self.parent.document.location.href results in</b><br><font color=red>htp://ww.omega.com/gamma</font><br>Same as above.<br><br><b>window.self.opener.top.document.location.href results in</b><br><font color=red>htp://ww.omega.com/</font><br>That's ok as Beta (the opener of gamma) is a frame in Omega.<br><br>window.self.opener.top.Alpha.document.location.href results in<br>htp://ww.omega.com/Alpha.html<br>Again, ok as Alph is another frame in Omega.<br><br>BUT...<br><b>window.self.opener.top.Beta.document.location.href</b> or <b>window.self.opener.document.location.href</b> results in<br>nothing, nadda. No error message - just blank space. The line looks something like :<br><br>window.self.document.write(&quot;window.opener.top.Beta.document.location.href = &quot;,window.opener.top.Beta.document.location.href) <br>and not even the id string in quotes prints.<br><br>Here is a real strangeness - I have experimented with the link in Beta which both calls Gamma as a popup and changes the URL displayed in Beta. If the new URL is within my site there is no problem. It ALL works. But if the URL is outside the site (I have tried various ones), then the results listed above hold.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top