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

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

1.window.location.href=“url”:改变url地址;

2.window.location.replace(“url”):将地址替换成新url,该方法通过指定URL替换当前缓存在历史里(客户端)的项目,
因此当使用replace方法之后,你不能通过“前进”和“后 退”来访问已经被替换的URL,这个特点对于做一些过渡页面非常有用!

时间: 2024-08-06 04:44:40

window.location.href 和 window.location.replace 的区别的相关文章

window.location.href和window.open的几种用法和区别

使用js的同学一定知道js的location.href的作用是什么,但是在js中关于location.href的用法究竟有哪几种,究竟有哪些区别,估计很多人都不知道了. 一.location.href常见的几种形式 目前在开发中经常要用到的几种形式有: 1 2 3 4 5 6 self.location.href;//当前页面打开URL页面 window.location.href;//当前页面打开URL页面 this.location.href;//当前页面打开URL页面 location.h

location.href和window.open的几种用法和区别

一.location.href常见的几种形式 self.location.href;//当前页面打开URL页面 window.location.href;//当前页面打开URL页面 this.location.href;//当前页面打开URL页面 location.href;// 当前页面打开URL页面 parent.location.href;//在父页面打开新页面 top.location.href;//在顶层页面打开新页面 ①如果页面中自定义了frame,那么可将parent.self.t

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

在页面中逐级进行点击请求以下页面: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(); 方法时,不会向服务器进行请求,因此

关于js中"window.location.href"、"location.href"、"parent.location.href"、"top.location.href"的用法(转)

iframe框架的页面跳转             var win = self.parent.document.getElementById('right').contentWindow; win.document.location.href = "VipManage.aspx"; ========================================================================== "window.location.href&

js中top.location.href、parent.location.href用法

window.location.href.location.href是本页面跳转 parent.location.href是上一层页面跳转 top.location.href是最外层的页面跳转 举例说明: window.location.href.location.href: 例:  代码如下 复制代码 window.location.href= 'wapsend1.asp?zimu=A&rev= '   +   form1.rev.value ; parent.location.href:C页

5. window.location.href/replace/reload()--页面跳转+替换+刷新

1.window.location=url; window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面. 一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_goBack"); ===================================================================

window.location.href/replace/reload()/页面跳转+替换+刷新

一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("url"); ============================================================================================ 二.window.location.href和window.location.replace的区别 1.window.location.href="url":改变u

window.navigate 与 window.location.href 的使用区别介绍

window.navigate(sURL)方法是针对IE的,不适用于FF,在HTML DOM Window Object中,根本没有列出window.navigate方法. 要在javascript中导航,不是调用window对象的某个方法,而是设置它的location.href属性,location属性是每个浏览器都支持的. 比如:<span onclick=”javascript:window.location.href=’#top’”>top</span>

关于js中window.location.href,location.href,parent.location.href,top.location.href的使用方法

关于js中"window.location.href"."location.href"."parent.location.href"."top.location.href"的使用方法 "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一层页面跳转 "top.locatio