加入收藏 | 设为首页 | 会员中心 | 我要投稿 核心网 (https://www.hxwgxz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 创业 > 正文

location.href和location.replace处理跳转的差异

发布时间:2018-10-02 22:22:19 所属栏目:创业 来源:站长网
导读:location.href 通常被用来跳转到指定页面地址,例如: location.href = 'http://www.mangguo.org' location.replace 方法则可以实现用新的文档替换当前文档,例如: location.replace('http://www.mangguo.org') location.replace 方法不会在 history 对象

location.href 通常被用来跳转到指定页面地址,例如:
location.href = 'http://www.mangguo.org'

location.replace 方法则可以实现用新的文档替换当前文档,例如:
location.replace('http://www.mangguo.org')

location.replace 方法不会在 history 对象中生成一个新的记录。当使用该方法时,新的 URL 将覆盖 history 对象中的当前记录。

(编辑:核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读