您的位置:首页 > 其它

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

2017-08-16 11:58 316 查看
在页面中逐级进行点击请求以下页面: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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: