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.
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.
I found the best solution was to use the base tag. Add the following to the head of the page in the iframe:
This will load all links on the page in the parent window. If you want your links to load in a new window, use:
This tag is fully supported in all browsers.
Yah I found
This useful for open all iframe links open in iframe.
And
This we can use for whole page or specific part of page.
Thanks all for your help.
With JavaScript:
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
.The most versatile and most cross-browser solution is to avoid use of the "base" tag, and instead use the target attribute of the "a" tags:
The
<base>
tag is less versatile and browsers are inconsistent in their requirements for its placement within the document, requiring more cross-browser testing. Depending on your project and situation, it can be difficult or even totally unfeasible to achieve the ideal cross-browser placement of the<base>
tag.Doing this with the
target="_parent"
attribute of the<a>
tag is not only more browser-friendly, but also allows you to distinguish between those links you want to open in the iframe, and those you want to open in the parent.Try
target="_top"