Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open new links outside of an iframe?

Is there any way to make an iframe act as if it were part of the page. Such as when I click a link, it either will open the links in a new tab/window by default, or have it so that when a link is clicked, it will open in the same window, but not just the iframe?

like image 460
Sean Avatar asked Nov 17 '10 04:11

Sean


2 Answers

You can just set the target attribute. To open in the current top window (top frame):

<a href="http://example.com" target="_top">Link Text</a>

Or to open in a new window:

<a href="http://example.com" target="_blank">Link Text</a>

There's also _parent for the parent window (not necessarily the top) and _self for the current window (the default).

like image 67
Nick Craver Avatar answered Nov 10 '22 14:11

Nick Craver


Do you have control of the content that is in the iframe?

You could use target=_top for the links.

like image 40
mrtsherman Avatar answered Nov 10 '22 14:11

mrtsherman