我的页面包含以下内容:

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

它会在 Chrome 中重定向,但不会在 Firefox 中重定向。为什么不?

最佳答案

在 Firefox 中,默认情况下自动刷新已被禁用。

要在浏览器中启用自动刷新:

  • 在您的网络浏览器
  • 的位置栏中输入 about:config
  • 出现一条消息:单击接受
  • 搜索块自动刷新
  • 将 accessibility.blockautorefresh 从 false 更改为 true

  • 最好使用替代方法,例如 JavaScript 或 PHP 重定向。

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

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

    关于html - 为什么元刷新在 Firefox 中不起作用?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29645340/

    10-12 00:10
    查看更多