我的页面包含这个:
<!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
- 出现一条消息:点击接受
- 搜索blockautorefresh
- 将 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/