javascript提供了两种页面重定向(redirection)的方法。分别是:

<script type=”text/javascript”>
location.href=’http://dev.collin.cn/’;
</script>

<script type=”text/javascript”>
location.replace(’http://dev.collin.cn/’);
</script>

两者的不同之处是前者会在浏览器的历史浏览记录(history对象)中增加一条新的记录,而后者则是相当于用replace中的url代替了现有的页面url,并把history中的url也替换为重定向后的url。


评论

Good.Be the first to comment on this entry.

Post comment

comment has COPYRIGHT too!