tdewald
asked on
Auto-Refresh at Specific Intervals
<meta http-equiv="refresh" content="3600">
Okay, what I'm trying to do is make a website auto-refresh every 60 minutes. The code above was originally for 10 seconds, and worked great. However, it doesn't work for 3600 seconds (1 hour). What code do I need to type to make it refresh once per hour?
Alternately, is there a way I can sync it to the computer's clock to just update at 5 minutes after the top of the hour?
Thanks.
Okay, what I'm trying to do is make a website auto-refresh every 60 minutes. The code above was originally for 10 seconds, and worked great. However, it doesn't work for 3600 seconds (1 hour). What code do I need to type to make it refresh once per hour?
Alternately, is there a way I can sync it to the computer's clock to just update at 5 minutes after the top of the hour?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
better of placing both since some browsers disable meta refresh:
<meta http-equiv="refresh" content="3600;URL=thesamep age.html">
<script type="text/javascript">
theHour="1"; //Input the hour
setTimeout("location.reloa d()",theHo ur*1000*60 *60)
</script>
and for the 5 minutes:
<meta http-equiv="refresh" content="300;URL=thesamepa ge.html">
<script type="text/javascript">
theMinutes="5"; //Input the minutes
setTimeout("location.reloa d()",theMi nutes*1000 *60)
</script>
gam3r
<meta http-equiv="refresh" content="3600;URL=thesamep
<script type="text/javascript">
theHour="1"; //Input the hour
setTimeout("location.reloa
</script>
and for the 5 minutes:
<meta http-equiv="refresh" content="300;URL=thesamepa
<script type="text/javascript">
theMinutes="5"; //Input the minutes
setTimeout("location.reloa
</script>
gam3r
Zontar, your answer is almost right, except for the delay in setTimeout. You are making it check every hour to see if it's five minutes after the hour. Not only would this be the same as the meta refresh, but it will likely never refresh considering that the chances of a user loading the page at five minutes past any hour is slim. Remove one of the 60s and it'll work - check every minute instead of every hour.
<script language="JavaScript">
<!--
if (document.images)
setTimeout('location.reloa
else
setTimeout('location.href = location.href',1000*3600);
//-->
</script>