window.location.replace

有3个页面 a,b,c

如果当前页面是c页面,并且c页面是这样跳转过来的:a->b->c

1:b->c 是通过window.location.replace("..xx/c")   此时b页面的url会被c页面代替,并且点击后退按钮时会回退到a页面(最开始的页面) 

2:b->c是通过window.location.href("..xx/c")    此时b页面的路径会被c页面代替,但是点击回按钮后页面回退的是b页面

 

两者的区别: 两者后退时所回退的页面不一样

时间: 2024-08-02 00:50:30

window.location.replace的相关文章

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(); 方法时,不会向服务器进行请求,因此

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,这个特点对于做一些过渡页面非常有用!

javascript:window.location.replace 与 window.location.reload() 刷新页面的不同效果

今天早上我发现一个问题,当一个网页的地址最后面是一个#时(比如:http://www.baidu.com/go.asp#), 执行:window.location.replace(window.location.href); 浏览器不刷新页面. 经过测试: window.location.href = window.location.href; 浏览器也不刷新页面. 经过测试:window.location.reload() ; 浏览器会刷新页面. 以前经过一些测试发现 window.locat

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

简单说说:有3个jsp页面(1.jsp,  2.jsp,  3.jsp). 进系统默认的是1.jsp ,当我进入2.jsp的时候, 2.jsp里面用window.location.replace("3.jsp");与用window.location.href("3.jsp");从用户界面来看是没有什么区别的, 但是当3.jsp页面有一个“返回”按钮,调用window.history.go(-1);wondow.history.back();方法的时候, 一点这个返回

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方法获取URL及window.location.assign(url)和replace(url)区别

本文转自:http://blog.csdn.net/chendi1985/article/details/5291773 window.location方法获取URL 统一资源定位符 (Uniform Resource Locator, URL) 完整的URL由这几个部分构成: scheme://host:port/path?query#fragment scheme:通信协议 常用的http,ftp,maito等 host:主机 服务器(计算机)域名系统 (DNS) 主机名或 IP 地址. p

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.location.Reload()和window.location.href 区别

window.location.Reload()应该是刷新.[相当于 按页面刷新按钮] (如果有数据提交的话,会提示是否提交的(是和否选项)) window.location.href=window.location.href; 是定向url提交数据 他们最大区别是 是否有数据提交: 前者提交数据的刷新                                                               后者没有提交的刷新 首先介绍两个方法的语法: reload 方法,该方

window.location

window.location方法获取URL及window.location.assign(url)和replace(url)区别 window.location方法获取URL 统一资源定位符 (Uniform Resource Locator, URL) 完整的URL由这几个部分构成: scheme://host:port/path?query#fragment scheme:通信协议 常用的http,ftp,maito等 host:主机 服务器(计算机)域名系统 (DNS) 主机名或 IP