IE6下 JS location.href 跳转无法传递refer的问题

两个页面
a.html

<script> 

location.href="b.php"; 

</script>


b.php

echo $_SERVER["HTTP_REFERER"];


IE6下,使用 location.href 这种方式,b.php 页面无法正常接受refer信息。但是通过a标签点击能正常传递。
添加meta标签 refresh 方法也可以正常传递。

解决方案:
1、js 触发 a 标签点击事件实现。

<a id="refer" href="b.php" style="display:none;"></a>

<script> 

document.getElementById("refer").click(); 

</script>


2、head里面添加 meta refresh方法。

<meta http-equiv="refresh" content="0; url=b.php" />

添加新评论