Meta refresh

Meta refresh
HTML
This box: view · talk · edit

Meta refresh is a legacy method of instructing a web browser to automatically refresh the current web page or frame 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.

Contents

Usability

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

There are legitimate uses of meta-refresh, such as providing updates to dynamic web pages or implementing site controlled navigation of a website without 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 <head> to refresh page after 5 seconds:

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

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

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

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

<meta http-equiv="refresh" content="0; url=http://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.[2]

Alternatives

Alternatives exist for both uses of the <meta> tag.

For redirection

An alternative is by sending an HTTP redirection header, such as HTTP 301 or 302. It is the preferred way to redirect a user agent to a different page. This can be achieved by a special rule in the Web server or by means of a simple script on the Web server.

JavaScript is another alternative, but not recommended, because users might have disabled JavaScript in their browsers.

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 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.

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Meta Refresh-Tag — Meta Tag, der den Besucher einer Webseite nach einer vorgegeben Zeit auf eine Webseite weiterleitet ( Redirect ). Der Meta Refresh wird von Suchmaschinen nicht gerne gesehen und kann abgestraft werden. Die Abstraftung ist sehr wahrscheinlich,… …   SEO Wörterbuch

  • Meta element — Meta elements are the HTML or XHTML <meta … > element used to provide structured metadata about a Web page. Multiple elements are often used on the same page: the element is the same, but its attributes are different. Meta elements can be… …   Wikipedia

  • Refresh — may refer to:*Refresh rate, the rate at which a display illuminates *Meta refresh, an HTML tag *Memory refresh, reading and writing to the same area of computer memory *Refreshable Braille display, a device for blind computer users* Refresh My… …   Wikipedia

  • Méta-tag — Élément meta Un élément meta (ou métaélément, ou balise meta, ou meta tag par analogie avec l’anglais) est une information sur la nature et le contenu d’une page web, ajoutée dans l’en tête de la page au moyen de marqueurs HTML. L’élément meta… …   Wikipédia en Français

  • Méta tag — Élément meta Un élément meta (ou métaélément, ou balise meta, ou meta tag par analogie avec l’anglais) est une information sur la nature et le contenu d’une page web, ajoutée dans l’en tête de la page au moyen de marqueurs HTML. L’élément meta… …   Wikipédia en Français

  • META Tag — Meta Tags sind HTML Elemente auf einer Webseite, die Metadaten über das betreffende Dokument enthalten. Inhaltsverzeichnis 1 Allgemein 2 Beispiele 2.1 Seitenbeschreibung 2.2 Stichwörter 2.3 …   Deutsch Wikipedia

  • Meta-Tag — Meta Tags sind HTML Elemente auf einer Webseite, die Metadaten über das betreffende Dokument enthalten. Inhaltsverzeichnis 1 Allgemein 2 Beispiele 2.1 Seitenbeschreibung 2.2 Stichwörter 2.3 …   Deutsch Wikipedia

  • Meta-Tags — sind HTML Elemente auf einer Webseite, die Metadaten über das betreffende Dokument enthalten. Inhaltsverzeichnis 1 Allgemein 2 Beispiele 2.1 Seitenbeschreibung 2.2 Stichwörter 2.3 …   Deutsch Wikipedia

  • Meta Tags — sind HTML Elemente auf einer Webseite, die Metadaten über das betreffende Dokument enthalten. Inhaltsverzeichnis 1 Allgemein 2 Beispiele 2.1 Seitenbeschreibung 2.2 Stichwörter 2.3 …   Deutsch Wikipedia

  • Meta-Element — Das meta Element (unspezifisch bzw. falsch[1] oft als Meta Tag bezeichnet) dient in HTML oder XHTML Dokumenten zum Angeben von Metadaten. Es wird als leeres Element innerhalb des head Elements notiert.[2] Inhaltsverzeichnis 1 Allgemein 2 …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”