# Meta refresh

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Meta_refresh
> Markdown URL: https://mediated.wiki/source/Meta_refresh.md
> Source: https://en.wikipedia.org/wiki/Meta_refresh
> Source revision: 1291027926
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Method of instructing a browser to automatically refresh a web page

HTML HTML and variants Dynamic HTML HTML5 XHTML Basic Mobile Profile HTML elements and attributes HTML element article audio blink canvas div and span marquee meta video HTML attribute alt attribute HTML frame Editing HTML editor Text editor Character encodings and language Character encodings Character entity references (named characters) Unicode Language code Document and browser models Document Object Model Browser Object Model Style sheets CSS Font family Web colors Client-side scripting and APIs JavaScript WebCL HTMX Graphics and Web3D technology Web3D WebGL WebGPU WebXR W3C Validator WHATWG Quirks mode Web storage Rendering engine Comparisons Document markup languages Comparison of browser engines v t e

**Meta refresh** is a method of instructing a [web browser](/source/Web_browser) to automatically refresh the current web page or frame after a given time interval, using an [HTML](/source/HTML) [meta element](https://en.wikipedia.org/w/index.php?title=Meta_(element)&action=edit&redlink=1) 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), meta refresh can be used as a method of URL redirection.

## History

This feature was originally introduced by [Netscape Navigator](/source/Netscape_Navigator) 1.1 (circa 1995), in a form of HTTP header and corresponding HTML meta HTTP-equivalent element, which allows document author to signal client to automatically reload the document or change to a specified URL after a specified timeout.[1] It is the earliest [polling](/source/Polling_(computer_science)) mechanism available for [the web](/source/World_Wide_Web)[*[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed)*], allowing a user to see the latest update in a frequently-changing webpage, such as ones displaying football live scores or [weather forecast](/source/Weather_forecasting).

## Usability

Use of meta refresh is discouraged by the [World Wide Web Consortium](/source/World_Wide_Web_Consortium) (W3C), since unexpected refresh can disorient users.[2] Meta refresh also impairs the web browser's "back" button in some browsers (including [Internet Explorer 6](/source/Internet_Explorer_6) and before), although most modern browsers compensate for this ([Internet Explorer 7](/source/Internet_Explorer_7) and higher, [Mozilla](/source/Mozilla) [Firefox](/source/Firefox), [Opera](/source/Opera_(web_browser)), [Google Chrome](/source/Google_Chrome)).

There are legitimate uses of meta-refresh, such as providing updates to [dynamic web pages](/source/Dynamic_web_page) or implementing site controlled navigation of a website without [JavaScript](/source/JavaScript). Many large websites use it to refresh news or status updates, especially when dependencies on JavaScript and redirect headers are unwanted.

## Examples

Place inside the <head> element to refresh page after 5 seconds:

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

Redirect to https://example.com/ after 5 seconds:

<meta http-equiv="refresh" content="5; url=https://example.com/">

Redirect to https://example.com/ immediately:

<meta http-equiv="refresh" content="0; url=https://example.com/">

## Drawbacks

Meta refresh tags have some drawbacks:

- If a page redirects too quickly (less than 2–3 seconds), using the "Back" button on the next page may cause some browsers to move back to the redirecting page, whereupon the redirect will occur again. This is bad for usability, as this may cause a reader to be "stuck" on the last website.

- A reader may or may not want to be redirected to a different page, which can lead to user dissatisfaction or raise concerns about security.[3]

## Alternatives

Meta refresh uses the http-equiv meta tag to emulate the Refresh [HTTP](/source/Hypertext_Transfer_Protocol) header, and as such can also be sent as a header by an HTTP web server. Although Refresh is not part of the [HTTP](/source/Hypertext_Transfer_Protocol) standard, it is supported by all common browsers.

HTTP Header example of a redirect to https://example.com/ after 5 seconds:

Refresh: 5; url=https://www.example.com/

Alternatives exist for both uses of meta refresh.

### For redirection

An alternative is to send an HTTP redirection [status code](/source/HTTP_status_codes), such as [HTTP 301](/source/HTTP_301) or [302](/source/HTTP_302). It is the preferred way to redirect a [user agent](/source/User_agent) to a different page. This can be achieved by a special rule in the [Web server](/source/Web_server) or by means of a simple script on the Web server.

[JavaScript](/source/JavaScript) is another alternative, but not recommended, because users might have disabled JavaScript in their browsers.

The simplest way of JavaScript redirect using the onload property of the body tag:

<body onload="window.location = 'http://example.com/'">

<!-- Your content here -->

</body>

### For refresh

An alternative method is to provide an interaction device, such as a button, to let the user choose when to refresh the content. Another option is using a technique such as [Ajax](/source/Ajax_(programming)) to update (parts of) the Web site without the need for a complete page refresh, but this would also require that the user enable JavaScript in their browser.

You can refresh a web page using JavaScript **location.reload** method. This code can be called automatically upon an event or simply when the user clicks on a link. If you want to refresh a web page using a mouse click, then you can use the following code :

<a href="javascript:location.reload(true)">Refresh this Page</a>

## References

1. **[^](#cite_ref-netscape1.1-pushpull_1-0)** ["An Exploration of Dynamic Documents"](https://web.archive.org/web/20020124130844/http://home.netscape.com/assist/net_sites/pushpull.html). Netscape Communications Corporation. Archived from [the original](http://home.netscape.com/assist/net_sites/pushpull.html) on 2002-01-24. Retrieved 2020-04-24.

1. **[^](#cite_ref-FzhNL_2-0)** [Core Techniques for Web Content Accessibility Guidelines 1.0](https://www.w3.org/TR/WCAG10-CORE-TECHS/#auto-page-refresh) - W3C Note 6 November 2000

1. **[^](#cite_ref-xoikJ_3-0)** [Meta Refresh Tag](https://www.lifewire.com/meta-refresh-tag-3469046), An About.com article covering the use of the tag for page reloading or redirection

## External links

- [W3C Web Content Accessibility Guidelines (1.0): Ensure user control of time-sensitive content changes](https://www.w3.org/TR/WAI-WEBCONTENT/#gl-movement)

- [meta refresh deprecated by W3C](https://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element)

- [Use standard redirects: don't break the back button!](https://www.w3.org/QA/Tips/reback)

- [H76: Using meta refresh to create an instant client-side redirect](https://www.w3.org/TR/WCAG20-TECHS/H76.html)

---
Adapted from the Wikipedia article [Meta refresh](https://en.wikipedia.org/wiki/Meta_refresh) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Meta_refresh?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
