Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to Achive Automatic page Refresh

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 12-02-2009
Member
 
Join Date: Feb 2009
Posts: 90
How to Achive Automatic page Refresh
  

Hello,

I have seen many sites where their pages automatically Refreshed, I always wonder that there should be lengthy code running behind it . I have created a page with some photos that should change periodically, and for that I want my webpage to simply refresh itself automatically.

Is there any easy way to make a simple page "refresh" automatically? Thanks

Reply With Quote
  #2  
Old 12-02-2009
Member
 
Join Date: Mar 2008
Posts: 258
Re: How to Achive Automatic page Refresh

Theres also a meta tag that you can define on the head, but not sure wheter it refreshes even if the content has not finished loading or if it starts counting when the head section loaded. Code would be something like that:

<meta http-equiv="refresh" content="600">
Reply With Quote
  #3  
Old 12-02-2009
Member
 
Join Date: Mar 2008
Posts: 227
Re: How to Achive Automatic page Refresh

This refresh page javascript code automatically reloads the webpage at a given time period. By default, the refresh action is displayed in the status bar. This can be set to no. Simply follow the instructions within the javascript comments.

This script below has been set to refresh a web page after 30 seconds but you can configure the refresh time to suit your needs. Very useful to give live scores for football, basketball and other games, etc.

Adding the javascript to your webpage:

Copy the javascript code below and paste this between the <head> and </head> tags of your web site page. Change the refresh interval where indicated.

Code:
<script 
language="JavaScript"> // CREDITS: // Automatic Page Refresher by 
Peter Gehrig and Urs Dudli www.24fun.com // Permission given to use the script 
provided that this notice remains as is. // Additional scripts can be found at 
http://www.hypergurl.com // Configure refresh interval (in seconds) var refreshinterval=5 
// Shall the coundown be displayed inside your status bar? Say "yes" 
or "no" below: var displaycountdown="yes" // Do not edit the 
code below var starttime var nowtime var reloadseconds=0 var secondssinceloaded=0 
function starttime() { starttime=new Date() starttime=starttime.getTime() countdown() 
} function countdown() { nowtime= new Date() nowtime=nowtime.getTime() secondssinceloaded=(nowtime-starttime)/1000 
reloadseconds=Math.round(refreshinterval-secondssinceloaded) if (refreshinterval>=secondssinceloaded) 
{ var timer=setTimeout("countdown()",1000) if (displaycountdown=="yes") 
{ window.status="Page refreshing in "+reloadseconds+ " seconds" 
} } else { clearTimeout(timer) window.location.reload(true) } } window.onload=starttime 
</script>
Reply With Quote
  #4  
Old 12-02-2009
Member
 
Join Date: Jan 2006
Posts: 211
Re: How to Achive Automatic page Refresh

put the next line at the top of the page you wish to refresh :

<meta http-equiv=refresh content="X; URL=/..../index.html">

Replace X with an integer representing the number of seconds before the refresh.

The URL can be a path on the local computer or a link like http://go.to.that.site/index.html
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Achive Automatic page Refresh"
Thread Thread Starter Forum Replies Last Post
How to Auto refresh web page in firefox 4 NigmA DogE Technology & Internet 5 14-04-2011 06:19 AM
Page never load even on many refresh Austin Power Networking & Security 4 18-02-2011 07:49 AM
How to Auto Refresh Web Page in Chrome? Jagadamba15 Technology & Internet 5 15-03-2010 11:45 AM
Close pop-up window and refresh parent page Chrisch Software Development 3 16-05-2009 06:47 PM
How to stop automatic page refresh (IE6) on Drudgereport.com ? Beant TroubleShoot 98 3 12-04-2008 05:23 AM


All times are GMT +5.5. The time now is 01:49 AM.