How to redirect page from iframe script

How to redirect page from iframe script

In some cases, we want to show our pages using iframe. we may also have links in frame. When we click on the link, the page which we want to show is loaded inside frame. But If we want to show it in a main page means we can do as follows.

Example

<iframe src=”anotherpage.html” mce_src=”anotherpage.html” height=”295″ width=”790″></iframe>

For example in anotherpage.html, we have the following data.

<div>

This is the page which is shown inside frame.

Click <a href=’sample.html’>here</a> to view page

</div>

The above code will reload sample.html inside frame. We can load it in main page by changing the above code as follows.

<div>

This is the page which is shown inside frame.

Click <a href=’#’ onClick=”parent.location.href=’sample.html’” >here</a> to view page

</div>

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.