location.href和location.replace处理跳转的差异
发布时间:2018-10-04 13:06:06 所属栏目:模式 来源:站长网
导读:location.href 通常被用来跳转到指定页面地址,例如: location.href = 'http://www.mangguo.org' location.replace 方法则可以实现用新的文档替换当前文档,例如: location.replace('http://www.mangguo.org') location.replace 方法不会在 history 对象
location.href 通常被用来跳转到指定页面地址,例如: location.replace 方法则可以实现用新的文档替换当前文档,例如: location.replace 方法不会在 history 对象中生成一个新的记录。当使用该方法时,新的 URL 将覆盖 history 对象中的当前记录。 (编辑:湘西站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |