views:

3339

answers:

5

i need to open the link in the same parent page, instead of open it in a new page.

note : The iframe and parent page are the same domain.

+2  A: 

Use target-attribute:

<a target="_parent" href="http://url.org"&gt;link&lt;/a&gt;
nnevala
i try this , is open in new window
Haim Evgi
A: 

Try target="_parent" attribute inside the anchor tag.

Gee
i try this , is open in new window
Haim Evgi
Try target="_top". The iframe might contain nested iframes? Or the actual link is opened by javascript on onclick event?
Gee
i have tried this but was opened in new window
Haim Evgi
+2  A: 

As noted, you could use a target attribute, but it was technically deprecated in XHTML. That leaves you with using javascript, usually something like parent.window.location.

Ryan McGrath
+1  A: 

There's a DOM Object called <Base /> which : "Specify a default URL and a default target for all links on a page:"

<base target="_blank" />

by speifing "_blank" you make sure all links inside the iframe will be opened outside.

vsync
+1  A: 

I found the best solution was to use the base tag. Add the following to the head of the page in the iframe:

<base target="_parent" />

This will load all links on the page in the parent window. If you want your links to load in a new window, use:

<base target="_blank" />
Chris Lindsay