Why does meta refresh not work in Firefox?

Benubird picture Benubird · Apr 15, 2015 · Viewed 7.5k times · Source

My page contains this:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="refresh" content="5; URL=http://www.example.com">
    </head>
    <body>
        test
    </body>
</html>

It redirects in Chrome, but not in Firefox. Why not?

Answer

Stewartside picture Stewartside · Apr 15, 2015

In Firefox autorefresh has been disabled by default.

To enable autorefresh in your browser:

  1. type about:config in the location bar of your webbrowser
  2. a message appears: click to accept
  3. search for blockautorefresh
  4. change accessibility.blockautorefresh from false to true

It would be best to use alternatives such as a JavaScript or PHP Redirect.

JavaScript

window.setTimeout(function() {
    window.location.href = 'http://www.google.com';
}, 5000);

PHP

header("refresh:5;url=wherever.php");