Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto refesh page at certain time?

Status
Not open for further replies.

brightstar

Technical User
Sep 20, 2002
233
Hellooo averyone.
how can i automatically refresh a page if someone has it open at 2pm?
using javascript?

free, anonymous advice provided by the whole world
 
If you are using the time on their computer it is fairly easy....

<script>

now = new Date()
refreshTime = new Date(now.getFullYear(), now.getMonth(), now.getDay(), 14, 0, 0, 0)
if (refreshTime > now){
refreshTime.setDay(refreshTime.getDay() + 1)
}

function checkTime(){
now = new Date()
if (now > refreshTime){
document.location = &quot;myPage.htm&quot;
}
setTimeout(&quot;checkTime()&quot;,1000)
}

</script>
<body onLoad=&quot;checkTime()&quot;>


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

 
<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;60&quot;>

you just put thist tag up in the header
 
The W3C advise against meta-refreshes (for accessibility reasons, amongst others). The preferred method is server-side refreshes. An advantage is that this does not require the user to have a javascript enabled client.

brightstar - What platform are you developing on?
static site? php? asp? etc...

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top