Monday, January 6, 2014

Html >>IFrame tag - (PART_40)

Topic: I want a small portion in my page to reload after every interval, how to do it?

Explanation:  As in the question, some time we may face a situation where only a small portion or content of the page should be dynamically updated after every few seconds. Then it is not wise to load the full page. Then we go for iframe.

Here we do it in three steps

Step1:
Separate the content that needs to be updated dynamically in to a separate page.

Example: test.php
<html>
<head> </head>

<body bgcolor=green>
Dynamic Content Page
</body>
<html>

Step2:
Add 
auto refresh to this page.
i.e. copy the meta tag in to the header of the page. (e.g: test.php)
Example: 
test.php
<meta http-equiv="refresh" content="5" >

Step3:
Set the dynamic page in to our main page using iframe.
Here we use tables and the iframe page is set in site one of the table columns.

Example: 
<html>
<body>
This is iframe test page. You can see that only the content in the below box, which is a iframe gets loaded after every 5 second. <br><br>
<iframe src="test.php" width=100 height=100 frameborder=0 scrolling=no>
</iframe>
</body>
</html>