Link of iframe open in the parent window


If you are using iframe in your webpage you might encounter a problem while changing the whole page through a HTML hyperlink (anchor tag) from the iframe. There are two solutions to mitigate this problem. 

Solution 1. You can use target attribute of anchor tag as given in following example.

<a target="_parent" href="">link</a>

Solution 2. You can also open a new page in parent window from iframe with Java Script.
<a href="#" onclick="window.parent.location.href='';">

Remember ⇒  target="_parent"  has been deprecated in XHTML, But it is still supported in HTML 5.x

Good Luck !!

Posted by Andy on 2015-03-28 07:11:14.0