CodeClerks

Auto refresh script



Write the reason you're deleting this FAQ

Auto refresh script

Some scripts like this one will allow you to automatically refresh or reload your page. This script could be useful if you own a site where content updates frequently (such as blog comments). However, you use this script, it's easy to install. And, you can change the variables to suit your own needs.

<script>
<!--

//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>

Comments

Please login or sign up to leave a comment

Join
SyedBahadurShah
Nice For Sharing Marlin

- Syed Bahadur Shah



Are you sure you want to delete this post?

ultimate
Considering the fact that it's taking into account if the images have loaded and then starts timer.

Although, for simple needs, HTML has a solution :
[HTML]<meta http-equiv="refresh" content="30">[/HTML]
where 30 is the number of seconds you need to wait before reload. It can be anywhere between 1 sec to a day or higher.

*you have to place this inside <head> tag



Are you sure you want to delete this post?

WebMania
@Marlin: Nice script you have shared here. This will help someone.



Are you sure you want to delete this post?

shehabmedhat
wooooooooooow i like this coooods



Are you sure you want to delete this post?

WebMania
I tested this code, Working fine for me.



Are you sure you want to delete this post?