Meta refresh

From Wikipedia, the free encyclopedia

Meta refresh is a method of instructing a web browser to automatically refresh the current web page after a given time interval, using an HTML meta element with the http-equiv parameter set to "refresh" and a content parameter giving the time interval in seconds. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in the content parameter. By setting the refresh time interval to zero (or a very low value), this allows meta refresh to be used as a method of URL redirection.

[edit] Usability

Using meta refresh for redirection is considered by the W3C to be a poor practice, since it does not communicate any information about either the original or new resource to the browser (or search engine). Many web design tutorials also point out that client side redirecting tends to interfere with the normal functioning of a web browser's "back" button. After being redirected, clicking the back button will cause the user to go back to the redirect page, which redirects them again. Some modern browsers seem to overcome this problem however, including Safari, Mozilla Firefox and Opera. Others, like IE, can be "tricked" by doing two rapid clicks of the "back" button - the first lands you on the redirect page, and before the time interval expires the second click takes effect to land you on the previous page. The use of zero delay redirects may cause the two rapid clicks technique to be impossible.

The W3C's Web Content Accessibility Guidelines (7.4) discourage the creation of auto-refreshing pages, since most web browsers do not allow the user to disable or control the refresh rate.

[edit] Examples

Refresh page after 5 seconds:

<meta http-equiv="refresh" content="5"/>

Redirect to wikipedia.org after 5 seconds:

<meta http-equiv="refresh" content="5;url=http://wikipedia.org"/>

Redirect to wikipedia.org immediately:

<meta http-equiv="refresh" content="0;url=http://wikipedia.org"/>

[edit] External links

Languages