Forum Moderators: open

Message Too Old, No Replies

iFrame Links

Linking from an iframe

         

dimo414

4:23 am on Sep 26, 2005 (gmt 0)

10+ Year Member



I have a simple free website that I want to insert an iframe code into so that I can have the same navigation bar on each page, so that I don't have to do it for every page.

When I created the code
<iframe frameborder=0 width=90% src=file.htm></iframe>
it loads into the page just the way I want it, however, when I click a link inside the frame, it opens the page inside the same frame. So my question is, how can I make a link inside an iframe open in the original page?

Also, if there is a better way of doing this, other than iframes, I'd love to here it!

encyclo

1:09 am on Sep 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the forums dimo414!

In order to get the links within the iframe to load within the parent document, you need to specify this on the links themselves with the

target
attribute:

<a href="page.html" [b]target="_parent"[/b]>link to parent</a>

dimo414

3:29 am on Sep 27, 2005 (gmt 0)

10+ Year Member



Great, thank you so much for the help!

dimo414

3:41 am on Sep 27, 2005 (gmt 0)

10+ Year Member



Sorry, hit submit by accident.

So if I wanted to make a link, whether from a iframe or the parent page, open in an iframe, I simply say target="_iframe name"?

tedster

9:12 am on Sep 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right -- except if the link is in the iframed docment, then you don't need to add a target attribute. Doesn't hurt, but you don't need it.