Search code examples
htmliframeparent

How to open only some links in a iframe on the parent window


i have an iframe on a page which opens a calendar application, in this application, I have some links that are of the app itself, while some other links should open in the parent window.

using: <base target="_parent" /> makes all the links opens in the parent window, but i would like only some kind of links to target the parent window, not all...

is it possible to have a crossbrowser solution?


Solution

  • It seems you don't really need the <base> tag. You could just use the the target attribute on those links (<a>) you want to behave differently.

    If you still want to use <base>, the target will be the one specified by <base> for those links without the target attribute.

    For instance:

    <base target="_self"></base>
    <a href="http://stackoverflow.com" target="_parent">Open SO in parent window/tab</a>
    <br/>
    <a href="http://stackoverflow.com" >Open SO in this window/tab</a>
    

    jsFiddle