Home page
 
 Home 
 ASP 
 PHP 
 SQL 
 HTML 
 JavaScript 
 Search 
 Contact 
 
Search
or browse popular tags
Subscription

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

Meta Refresh Tag. How to reload the web page.

Print

One of the most common uses of the meta tag is to reload the web page. This is great for displaying real-time data, or as real as the refresh rate. It is very convenient to use it if you have a dynamic content on your page (for example a weather map). This tag is easy to use and misuse.

To refresh the current page you should put the meta tag to the<head> of your HTML document. The syntax is as follows:

<meta http-equiv="refresh" content="300">

This will reload page automatically every 300 seconds.

The http-equiv attribute tells the browser that this meta tag is sending an HTTP command rather than a standard meta tag. Refresh is an actual HTTP header used by the Web server. It tells the server that the page is going to be reloaded.

The content attribute set the time, in seconds, until the browser should reload the current page.

Meta refresh tag also has some disadvantages. Refreshing the current page can confuse people. If they didn't request the reload, some people can get concerned about security.

You should also remember that if the redirect happens quickly (less than 2-3 seconds), readers with older browsers can't hit the "Back" button.




Tags:

Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments





Copyright © 2005-2014             www.WebCheatSheet.com All Rights Reserved.