Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Automatic page refresh at specific time of day?Helpful Member! 

Shrap (TechnicalUser) (OP)
4 Apr 07 12:00
Hi guys,

Basically, cutting a long story short. I'm in need of a script which refreshes a web page at a certain time of day (in my case, 1pm) instead of a generic refresh after a pre-defined number of minutes.

Is this possibly to do? If so, how? Any advice would be great.

Thanks all.
Helpful Member!  kaht (Programmer)
4 Apr 07 12:08
Not sure why you'd want to do this, but this should work:

CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>title test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">

//60000 milliseconds is 1 minute
window.setInterval("checkForRefresh()", 60000);

function checkForRefresh() {
   var now = new Date();
   if (now.getHours() == 13 && now.getMinutes() == 0) {
      window.refresh();
   }
}



</script>
<style type="text/css"></style>
</head>
<body>
</body>
</html>

-kaht

Looking for a puppy?  http://www.silkypups.com
(Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)

monksnake (Programmer)
4 Apr 07 12:25
That's a busy dog in the background. (the page)

monkeysnake <.

trollacious (Programmer)
4 Apr 07 12:31
What time zone do you want to use for the standard?  Your best bet to make sure everyone viewing the page does it at the same time is to write the server time in the Javascript with server-side scripting, then calculate the offset from the time on the client-side computer and work from there.  Otherwise you're at the mercy of the time on the client computer, which will vary depending on time zone and other things.

Lee
Shrap (TechnicalUser) (OP)
4 Apr 07 12:34
Hi guys,

All I want to do is make the page auto refresh at 1pm.  It's only going to be used internally, on a select few of computers.  

CODE

<script type="text/javascript">

//60000 milliseconds is 1 minute
window.setInterval("checkForRefresh()", 60000);

function checkForRefresh() {
   var now = new Date();
   if (now.getHours() == 13 && now.getMinutes() == 0) {
      window.refresh();
   }
}



</script>

So that should be all I need?

Thanks.
Shrap (TechnicalUser) (OP)
4 Apr 07 12:35
I forgot to mention that the time zone would be GMT, as I live in the UK.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close