Showing posts with label Location. Show all posts
Showing posts with label Location. Show all posts

Friday, January 09, 2009

页面重定向与url中的hash在不同的浏览器中的表现

访问时url上带有hash(如http://localhost/a.php#test),重定向到b.php页面时,当前a.php页上hash会被带到b.php页面上,在Firefox/Opera上测试的效果是如此,但IE6上则直接到b.php页,不会将a.php页上hash值带过来。
示例代码:
a.php
<php
header("Location: b.php");
?>
b.php
<php
?>
访问http://localhost/a.php#test,跳转完成后url为http://localhost/b.php#test

Monday, October 22, 2007

window.location and document.location

window.location 和 window.location.herf 为可读写的属性,对此赋值可定向页面去指定的URL。
document.location 和 document.URL 等价,是可只读属性,并且推荐使用document.URL,document.location 已废弃。不过多数浏览器还是可以对document.location 和 document.location.href 赋值定向到新的URL,此做法不推荐使用。