【问题标题】:header() with delay not working in IEheader() 延迟在 IE 中不起作用
【发布时间】:2012-08-07 20:45:25
【问题描述】:

我无法...

<?php
   header( "Refresh: 5; URL=http://www.mywebsite.com" );
?>

...在 Internet Explorer 中工作(该死!)。

它在 Chrome 中运行良好,如果我使用...

header("Location: http://www.mywebsite.com");

...它适用于两者,但我没有延迟。

【问题讨论】:

标签: php internet-explorer header


【解决方案1】:

尝试将其作为元标记包含在内,或通过 JavaScript 重新加载。

元标记:

<meta http-equiv="refresh" content="5;URL='http://example.com/'">

Javascript:

window.onload = new function() {
  setTimeout(function() {
    location.reload();
  }, 5000);
};

【讨论】:

  • 谢谢!虽然我最终得到了 location.href = "mywebsite.com" 而是因为我希望它重定向而不是刷新:)
  • @Oskwish 没问题。很高兴这很有帮助。 ;)
猜你喜欢
  • 1970-01-01
  • 2011-05-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-03
相关资源
最近更新 更多