Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does meta refresh not work in Firefox?

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?

like image 309
Benubird Avatar asked Feb 10 '23 10:02

Benubird


2 Answers

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");
like image 60
Stewartside Avatar answered Feb 13 '23 03:02

Stewartside


On Firefox the auto refresh is disabled by default.

You can configure Firefox manually by entering "about:config" in the browser's address bar. A warning message will appear; click on "I'll be careful, I promise!" to be able to continue.

Next, type "Accessibility.blockautorefresh" in the search box at the top of the page. Double-click the "true" value next to this preference to set it to "false" and allow the browser pages to auto-refresh.

Or use Javascript to redirect to the page.

window.setTimeout(function() {
    window.location.href = "https://www.google.com/";
}, 2000);

Or you can add one line code to the body tag:

<body onload="setTimeout(location.href='https://www.google.com/', 2000)">
like image 26
Kurenai Kunai Avatar answered Feb 13 '23 04:02

Kurenai Kunai