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
Posted
Updated 20-Nov-19 1:40am
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi,

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.

http://www.mindfiresolutions.com/Autorefresh-an-ASPNET-aspx-web-page-37.php[^]

Auto Refresh Web Page[^]

http://www.grizzlyweb.com/webmaster/javascripts/refresh.asp[^]
   
v2
Comments
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
   
great
Rate this:
Please Sign up or sign in to vote.

Solution 1

Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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;
// ]]>
</script>
</head>

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


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

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