Given the following HTML, is it possible for the anchor tag in the iframe to target the parent window?
<div>
<iframe src="/pageview.html"></iframe>
</div>
iframe (pageview.html) content :
<a href="http://www.google.com">link</a>
You want the target
attribute:
<a href="something" target="_parent">go</a>
Using _parent
will target the frame's immediate parent window. To target the top window, use _top
.
<div>
<iframe src="/pageview.html">
<a onclick="javascript:window.parent.location.href='http://www.google.com'; return false;">link</a>
</iframe>
</div>
Should be something like that...
href
attribute, which has implications for CSS, keyboard navigation, accessibility, and SEO. And, just to nit-pick, you should not use the javascript:
prefix in an onclick
attribute. Use target="_parent"
instead. It is cross-browser, and semantically correct. This is exactly what the target
attribute is for.
<iframe>
without JavaScript. It also doesn't make sense for the iframe to have content