How to open iframe link in parent window / new window
Normally if you click on any link in iframe content it will automatically open new page inside iframe window. But you make those links to be openend in the parent window or new window by using target property of anchor tag.
By setting target='_parent' links will open in same window which holds the iframe content, like the target='_blank' will open the links on new window.
Example:
index.php
ifr.php
If you want todo same thing without using target attribute on each anchor tag, then checkout this post: Open iframe link on parent / new window without using target attribute
By setting target='_parent' links will open in same window which holds the iframe content, like the target='_blank' will open the links on new window.
Example:
index.php
<html>
<body>
<iframe src="ifr.php" width=300 height=300></iframe>
</body>
</html>
<body>
<iframe src="ifr.php" width=300 height=300></iframe>
</body>
</html>
ifr.php
<html>
<body>
<?php
echo "<a target='_blank' href='http://webdevelopmentscripts.com'>Open in new window</a><br><br>";
echo "<a target='_parent' href='http://webdevelopmentscripts.com'>Open in same window</a><br><br>";
?>
</body>
</html>
<body>
<?php
echo "<a target='_blank' href='http://webdevelopmentscripts.com'>Open in new window</a><br><br>";
echo "<a target='_parent' href='http://webdevelopmentscripts.com'>Open in same window</a><br><br>";
?>
</body>
</html>
If you want todo same thing without using target attribute on each anchor tag, then checkout this post: Open iframe link on parent / new window without using target attribute
Comments (0)