Results 1 to 4 of 4

Thread: How to Achive Automatic page Refresh

  1. #1
    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

  2. #2
    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">

  3. #3
    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>

  4. #4
    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

Similar Threads

  1. How to Auto refresh web page in firefox 4
    By NigmA DogE in forum Technology & Internet
    Replies: 5
    Last Post: 14-04-2011, 06:19 AM
  2. Page never load even on many refresh
    By Austin Power in forum Networking & Security
    Replies: 4
    Last Post: 18-02-2011, 07:49 AM
  3. How to Auto Refresh Web Page in Chrome?
    By Jagadamba15 in forum Technology & Internet
    Replies: 5
    Last Post: 15-03-2010, 11:45 AM
  4. Close pop-up window and refresh parent page
    By Chrisch in forum Software Development
    Replies: 3
    Last Post: 16-05-2009, 06:47 PM
  5. Replies: 3
    Last Post: 12-04-2008, 05:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,490,385.15880 seconds with 17 queries