码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2017-08-16 12:30:12      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:win   ace   replace   服务   服务器   lan   页面   target   返回   

在页面中逐级进行点击请求以下页面: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

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

标签:win   ace   replace   服务   服务器   lan   页面   target   返回   

原文地址:http://www.cnblogs.com/hihtml5/p/7372706.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!