Click here to Skip to main content
15,747,637 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all,

I have to refresh a page at each hours e.g(1,2,3.....24).

Please help

Mohd Wasif
Updated 19-Mar-23 16:11pm

Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
// <![CDATA[
    function bed(){
        var now = new Date();
        var hr = now.getHours();
        var targ = document.getElementById('time_alert');

        targ.firstChild.nodeValue = (hr <= 23) ? hr+"00 Hours. You're good!!" : hr+"00 Hours. You need to go to bed";

        setTimeout('bed()', 3600000);

    onload = bed;
// ]]>

<span id="time_alert">&nbsp;</span>

Or else have a look on following link for reference:
Refresh a page[^]
Auto Postback or Refresh page for every defined time interval[^]
Share this answer

You can use meta tag to achieve this:
<meta http-equiv="refresh" content="3600">

Here content is number of seconds after which page will be refreshed.[^]

Auto Refresh Web Page[^][^]
Share this answer
Mohd Wasif 10-May-12 2:18am    
I want that if time is 1:00 am .....12:00 pm then each hours I want page to be refreshed.
Deepak_Sharma_ 10-May-12 2:37am    
Go to last url above and in the refresh() function try to put your logic to refresh page in your preferred time
lllomh 22-Nov-19 1:03am    
<pre lang="Javascript">

  // reload the page
}, 3600000); // 3600000 milliseconds = 1 hour
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900