Click here to Skip to main content
14,491,885 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all,

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

Please help

Mohd Wasif
Updated 20-Nov-19 1:40am
Rate this:
Please Sign up or sign in to vote.

Solution 2


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[^][^]
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

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[^]

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100