Meta refresh is a 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. This method is deprecated and should not be used.

Usability

Use of meta refresh is discouraged by the W3C, since unexpected refresh can disorient users. 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 (Mozilla Firefox, Opera, Internet Explorer 7).

Alternatives to meta refresh include JavaScript, or HTTP redirection headers such as HTTP 301.

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

Alternatives

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

For redirection

A 301 or 302 HTTP redirect 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 (such as mod_alias or mod_rewrite in Apache) or by means of a simple script on the web server (such as PHP's header() function).

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

For refresh

The recommended way 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 website without the need for a complete page refresh, but this would also require that the user has Javascript.

References

  1. ^ Core Techniques for Web Content Accessibility Guidelines 1.0 - W3C Note 6 November 2000
  2. ^ Meta Refresh drawbacks

External links

  • W3C Web Content Accessibility Guidelines (1.0): Ensure user control of time-sensitive content changes
  • meta refresh deprecated by W3C
  • Use standard redirects:

    Meta refresh - Wikipedia, the free encyclopedia

    Alternatives exists for both uses of the tag. [edit] For redirection. A 301 or 302 HTTP redirect is the preferred way to redirect a user agent to a different page.

    ...

    Meta Refresh Tag

    The Meta Refresh Tag. One of the most common uses of the meta tag is to reload and redirect Web pages. This tag is easy to use and misuse. Reload the Current Page with the Meta ...

    ...

    What are meta redirect tags or meta refresh tags? - Search Engine ...

    Describes the meta redirect tag (called 'meta refresh') and provides instructions for using meta redirect tags.

    ...

    Help:Redirect - Meta

    See also: Wikipedia:Redirect. A redirect is a page that automatically redirects the reader's browser to a specified target page. Redirects are used to help users locate information ...

    ...

    Pywikipediabot/redirect.py - Meta

    Script which fixes double redirects, and deletes broken redirects. Requires access to MediaWiki's maintenance pages or to a XML dump file. Delete function requires adminship.

    ...

    It’s Called Web Design » Meta/HTML Redirect

    Not the best method, but it works. Put this at the beginning of your document: HTTP/1.1 301 Moved Permanently Location: http://www.example.org/ Content-Type: text/html Content ...

    ...

    Landing Page Code (Meta Redirect)

    Attn: The 202 Support Forum will now be revised Within the next few weeks the Tracking202 Support Forum will be revised. Some threads will be shut down or reorganized.

    ...

    Landing Page Code (Meta Redirect)

    Posted: May 29th, 2008 at 5:58pm Post subject: Landing Page Code (Meta Redirect)

    ...

    META Redirect - HTML Tutorials

    Reloading: Did you notice that the previous page waited 5 seconds and then loaded this page? You might think was done with some fancy Java or Java Script, but it was done ...

    ...

    Meta Redirect

    Meta Redirect Search Engine Optimization ... I hope this is the right forum. If not I am sorry. I have a blog. I update my blog daily.

    ...