How to Refresh Web Pages Automatically

If you have a website that frequently updates its contents over short periods of times, such as for news updates or changing sports scores, you may want your site to automatically refresh itself at set intervals. With a few lines of HTML or Javascript code you can easily add that sort of functionality to your website.

...
Refresh Web Pages Automatically

Step

Open the text file that you are using to edit the HTML code of your web page or navigate to the file manager of your web host and click on the link to edit your website.

Step

Find the opening and closing <HEAD> tag at the top of the page. Type in the "Meta HTTP-EQUIV" tag anywhere in the <HEAD> area.

Step

Add in the "Content" and "URL" attributes to specify how long to wait before refreshing and what the URL of the website is that needs to be reloaded. For example type in <Meta HTTP-EQUIV="Refresh" Content="15; URL=http://www.mywebpage.com"&gt; if you want your website to refresh once every 15 seconds. Save the file to make the change permanent.

Step

Open the HTML file for your website and locate the <HEAD> tag. Specify that you will be using a Javascript code by typing in <script language="Javascript"> underneath the <HEAD> tag. Type in the opening and closing "<!--" and "//-->" tags to let the website know where your Javscript code begins and ends.

Step

Inside the Javascript tags type "var time = null" and "function move() {" on the next two lines. Add in a third line and specify the URL for the website that needs to be reloaded by typing "window.location = 'http://www.mywebpage.com.''

Step

Finish the Javascrpt code by finding the HTML <BODY> tag and adding the "onload" attribute. Type in the number of milliseconds that the website should wait before refreshing such as "<BODY onload="timer=setTimeout('move()',50000"> to set the time at 50 seconds. Finish your changes by saving the HTML file.