0
点赞
收藏
分享

微信扫一扫

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

云朵里的佛光 2022-06-21 阅读 46

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

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

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

举报

相关推荐

0 条评论