Log in

View Full Version : iframe linking to another iframe in a different page.



liquidSpin
01-27-2006, 04:21 PM
Ok,

not sure if this is possible and I've searched google and other places for help but didn't find anything that would help me.

I need a link that is in an Iframe to open up in another parent page with the intended link opening in the iframe of that parent page.

Can anyone here help me?

jscheuer1
01-28-2006, 06:14 AM
Where the link is, is not an issue so much as where you want it to open. In any case, this (if I understand you correctly) cannot be done with HTML alone. If this other parent page is already open (in another window) and has a name, javascript can do it (however, being sure that the user hasn't closed this other window in the meantime is a major issue). If clicking the link is to open a page in a new window, the iframe on the page in the new window must have its src attribute set to the desired page, either via its HTML attribute or via a script on that page that activates onload of that page (or at least after parsing of the desired iframe). A parameter could be passed to a script on the page that is opening in a new window, to tell it what page to open in its iframe via said script.

Now, this type of scripting is complicated and will be useless to non-javascript enabled browsers. The same overall effect can be achieved using simple HTML though. Say you have a link on a page in an iframe. You want it to open a page (we will call this pageC.htm) in an iframe on new page (we will call this pageB.htm) in a new window, do this for the link:


<a href="pageB.htm" target="_blank">Link Text</a>

Then the iframe on pageB.htm can look like so:


<iframe src="pageC.htm"></iframe>