Meta Refresh

The redirects to the provided URL in 5 seconds. Set to 0 for an immediate redirect.

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


  1. User Avatar
    Permalink to comment#

    This will only work if it is enabled in the browser settings. I belief it’s enabled by default but don’t depend on it.

    To be sure, always use a “Click here if it does not redirect in 5 seconds”-link.

    • User Avatar
      Kartlos Tchavelachvili
      Permalink to comment#

      Can you tell me were you can disable meta tag(s) in your browser settings? :)

  2. User Avatar
    Permalink to comment#

    Very easy. If you use Internet Explorer.

    I always use Firefox. But you’ve got to keep in mind that it is possible to disable meta refreshes. That’s why most sites have the “Click here to continue” or “Click here if it does not forward” links.

    En by the way, even while I’m using Firefox, I prefer those links. Most of the times it’s faster to click that link than to wait for their timer to finish and forward.

  3. User Avatar
    Kartlos Tchavelachvili
    Permalink to comment#

    Ok, but I think nobody will disable meta tags manually in their browser settings if they do not have special reason for it. In some cases you can not use url redirect(“click here”) or server side code, so this one comes useful.

    • User Avatar
      mark luiz
      Permalink to comment#

      bro i just like to say that u r smart as its true most of us will disable meta tags manually in their browser settings if they do not have special reason for it.
      I agree with ur point… Hats off… Bravo…

  4. User Avatar

    If someone has meta refresh disabled then I suggest people should use:

    – k0st4s

    • User Avatar

      >?php header( “refresh:5;url=YOUR URL” );<

    • User Avatar
      John D.
      Permalink to comment#

      Obviously header(“refresh:5;url=YOUR URL”); is a ridiculous and idiotic use of a php function. You can not create asynchronous delayed refreshes in PHP. The header function provides a header which has to be received by the client in the header part of your request. Also the syntax you provided is completely wrong and why would you even assume that html meta tags and php/http headers share a common layout?
      Do NOT listen to this guy. Either he’s a troll or he really is the dumbest person alive.
      It would be better for everybody if his entries got removed.

    • User Avatar
      Iain Collins
      Permalink to comment#

      I know this is super old, but I was amused how angry John D. evidently was about it.

      The ‘refresh’ header does in fact work just as described by Kostas, with exactly that syntax, and that indeed is how you set it in PHP using header().

      It’s entirely non-standard I think but it is (or at least was) supported by some browsers. I’m not sure how many still support it today. I think Netscape invented it but I don’t think it’s part of any W3C or IETF spec. A few older applications still set a ‘refresh’ header.

      The right approach to use for redirection is of course just to use a redirect header.

      Browsers don’t generally expose the functionality to turn off meta refreshing, but if you need to use it for some reason (e.g. because you can’t set headers), provide a link that takes the user to the same page too.

  5. User Avatar
    Muhammad Chafe
    Permalink to comment#

    Header(‘location: Ur URL’) ;
    Header(“refresh:10; url= ‘ ur URL’ “) ;

    Why header didn’t work if there is output before

  6. User Avatar
    Said Bakr

    I recommend the triple solution complex! i.e Javascript redirect, meta tag refresh and link to the destination page. I have a page that a counter should count for 60 seconds then javascript should redirect, some times the client claims that redirect failed, so I added meta tag to refresh at 62 seconds and a hidden link that javascript show it after 60 seconds.

Leave a Comment

Posting Code!

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.