header() 延迟在 IE 中不起作用


header() with delay not working in IE

我无法得到...

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

。在IE浏览器中工作(该死的!

它在 Chrome 中效果很好,如果我使用...

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

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

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

元标记:

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

Javascript:

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