Meta Refresh Tag. How to reload the web page.

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.



Leave a Reply

Your email address will not be published.