Reputation: 49
I have an iframe that pops up on an HTML page. In the iframe popup there is a link. When a user clicks the link I want the link to open a new tab in the main browsers and not in the iframe. I have tried adding the following
<a href="http://www.google.com" target="_parent">Test</a>
all this does is open the page in the main browser (not in a new tab) therefore the user leaves the page.
Any help appreciated!
Upvotes: 2
Views: 6816
Reputation: 39
i know its too late to reply, but may be this will be helpful for someone,
if you can place an iFrame to your website and do not want to be open its link to the same frame, just follow the simple steps below...
create an empty div with position absolute with the relative to its outer div...
Overlap the link button with this div, add tag and add the same link with target blank.
<div class="your_name"> <a href="domain.com">; </a> </div> <style type="text/css"> .your_name { position:absolute; top: 5px; /*adjust its top and left position as required*/ left:5px; } .your_name a { width:20px; /* add height and width as required */ height:10px; display:block; } </style>
cheers..!!!
Upvotes: 1
Reputation: 38147
Here are some values for the target
attribute
_blank
= Loads the page into a new browser window.
_self
= Loads the page into the current window.
_parent
= Loads the page into the parent
W3C Docs here on target attribute (right at the bottom)
Updated: as pointed out by @Eregrith in the comments below - you cannot make the link open in a new tab - that is controlled client side (in the browser settings) you can open it in a different window - using _blank
Upvotes: 8