How to Use the Meta Refresh Tag

The meta-refresh tag reloads pages or redirects to new ones

Illustration of website urls redirecting to other addresses

Tomas Knopp / Getty Images

The meta-refresh tag, or meta redirect, is one way that you can reload or redirect web pages. The meta refresh tag is easy to use, which means it is also easy to misuse.

Reloading the Current Page With the Meta Refresh Tag

Place the following meta tag within the head division of your HTML document. When used to refresh the current page, the syntax looks like this:

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

This code snippet refreshes the current page after 300 seconds.

Redirecting to a New Page With the Meta Refresh Tag

Another use of the meta refresh tag is to send a user from the page that they requested to a different page instead. The syntax for this is nearly the same as reloading the current page:

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

The content attribute is slightly different. It specifies the time, in seconds, until the page should be redirected. Following the semicolon is the URL of the new page to be loaded. Use a zero to redirect immediately.

The most common error when using a refresh tag to redirect to a new page is to add an extra quotation mark in the middle. For example, this syntax is incorrect: content="2;url="http://newpage.com". If you set up a meta refresh tag and your page doesn't redirect, check for that error first.

Drawbacks to Using Meta Refresh Tags

Meta refresh tags have some drawbacks:

  • Meta refresh redirects have been used by spammers to fool search engines. Search engines now often remove those sites from their database. If you use a lot of meta refresh tags to redirect pages, the search engines may decide your site is spam and delete it from their index. If you need to redirect an old URL to a new one, it's better to use a 301 Server Redirect instead. That redirect will actually let search engines know that a page has been permanently moved and that they should transfer any link rankings from that old page to the new one.
  • There can be a usability problem if the redirect happens quickly (less than 2-3 seconds). This setting prevents older browsers from using the back button.
  • If the redirect happens quickly and goes to a non-existent page, your readers may get stuck in a loop without seeing any content other than a 404 page.
Format
mla apa chicago
Your Citation
Kyrnin, Jennifer. "How to Use the Meta Refresh Tag." ThoughtCo, Sep. 30, 2021, thoughtco.com/meta-refresh-tag-3469046. Kyrnin, Jennifer. (2021, September 30). How to Use the Meta Refresh Tag. Retrieved from https://www.thoughtco.com/meta-refresh-tag-3469046 Kyrnin, Jennifer. "How to Use the Meta Refresh Tag." ThoughtCo. https://www.thoughtco.com/meta-refresh-tag-3469046 (accessed March 19, 2024).