views:

41

answers:

3

I am currently using a iframe on my main web page. When i click on a link in the iframe I would like it to display the content on the main web page. Any thoughts?

A: 

Set the target="_parent" on the link.

Another way would be to put this into the page that represents the content of the IFRAME:

<base target="_parent" />
Nissan Fan
A: 

use target='_top' on the link in your iframe

<a href='http://example.com' target='_top'>My Link</a>

This will result in the full window/tab of the browser being replaced with the content of the link. You could also use _parent as the value of the target attribute. That would result in the immediate parent of the iframe being replaced which may be what you want. It's possible though for iframes to be nested, so if a.html contains b.html, which contains c.html, a _top link in c.html would replace the entire page (a.html), but a target of _parent would only replace b.html.

Jason Jenkins
That won't work with IFRAMES.
Nissan Fan
Yes it will. At least in WebKit (Chrome/Safari) and Firefox.
Jason Jenkins
A: 

I haven't worked with iframes in ages, but I believe it's just <a href="myLink.html" target="_parent" />

quoo