Category Archives: Javascript- web page Auto refresh

Javascript- Auto refresh page

This tutorial explains how to refresh the page in a certain interval. Sometime you need to refresh the page automatically while using the session. You need to load the latest content automatically . So the webpage need to be refreshed.

Sample code
<script type=”text/JavaScript”>

function autoRefresh(timeToRefresh) {
setTimeout(“location.reload(true);”,timeToRefresh);
}

</script>
<p><a href=”javascript:autoRefresh(1000)”>Refresh page in 1 sec</a></p>

Next Example:

function updateDivContent(){
    // Assuming we have #shoutbox
    $('#divtoreload').load('page.php');
}
setInterval( "updateDivContent()", 10000 );

Business services and Business news Business international onlinlen publishing Business