window.location.href和window.location.replace的区别

在页面中逐级进行点击请求以下页面:a.html->b.html->c.html

window.location.href 做跳转 window.history.go(-1);window.history.back(); 方法时,会向服务器进行请求,根据服务器记录的请求进行跳转,因此会正确返回对应的页面b.html。

window.location.replace 做跳转 window.history.go(-1);window.history.back(); 方法时,不会向服务器进行请求,因此只会跳转至a.html,未能返回到上级b.html。

转自:http://www.cnblogs.com/wanghaokun/p/5962169.html

posted on 2017-08-16 11:58  代码ok  阅读(384)  评论(0编辑  收藏  举报