Monday, 30 September 2013

How to Auto Refresh web page

#easilylearnhtml #Javascript

     How to Auto Refresh Web Page

This script allows you to refreshes a webpage, after the specified amount of time. "Why use JavaScript to do this.

Simply insert the below code into the <head> portion of your page:

<script>
<!--

/*
Auto Refresh Page with Time script
By #adminBiigzee #zspc #eaSIlylearnhtml
*/

//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:30"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

window.onload=beginrefresh
//-->
</script>

you can also make use of the meta alternative code which is short and more precise

To make the page reload or refresh itself with meta tag, insert the below meta tag:

<meta http-equiv="refresh" content="5" >

The attribute http-equiv="refresh" calls for refresh of the page.

The attribute content="5" sets the time for refresh.

The time after which the page has to reload is set using the content attribute.

So if you want the page to refresh after every 10 seconds, set content value to 10.

We would recommend the time of refresh [reloading interval] be above 5 seconds. This is because you have to consider the page loading time.

by #adminbiigzee dont forget to like and share this post.!!