Document.location.href和.replace的区别
转自:https://www.cnblogs.com/GT_Andy/archive/2007/10/31/1922138.html
1 Document.location.href和.replace的区别
document.location.href和document.location.replace都可以实现从A页面切换到B页面,但他们的区别是: 用document.location.href切换后,可以退回到原页面。 而用document.location.replace切换后,不可以通过“后退”退回到原页面。 关于document.location.href或其他可回退的切换方式,我还发现一个细节, 用个例子来说明: 假设有A.htm B.htm C.htm三个页面 A.htm里有这样一句:document.location.href="/b.htm"; b.htm里有这样一句:document.location.href="/c.htm"; 注意两个都是可回退的切换。 1:当从A切换到B再切换到C时,实际内存中保留了三个页面:A、B、C 2:回退到B时,C页面被清出内存! 3:再次回退,到A页面时,B页面也被清出内存! 4:再次向前(不是用切换而是用向前)转到B页面时, 内存中保留的是A和B >>>当一个文档被location.replace()替换后,它就会从当前的历史对象中移除了
Document.location.href和.replace的区别的更多相关文章
- window.location.href和document.location.href、document.URL的区别
1.document表示的是一个文档对象,window表示的是一个窗口对象,一个窗口下可以有多个文档对象. 所以一个窗口下只有一个window.location.href,但是可能有多个documen ...
- window.location.href 和 document.location.href
document表示的是一个文档对象,window表示的是一个窗口对象,一个窗口下可以有多个文档对象. 所以一个窗口下只有一个window.location.href,但是可能有多个document. ...
- windows.open window.location.href的用法和区别
window.location.href 只能在当前页面打开,不能用新窗口打开 windows.open("URL","窗口名称","窗口外观设定& ...
- 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法与区别(跳出iframe方法)
"window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...
- 解决document.location.href下载文件时中文乱码
1:tomcat 安装路径下 找到 conf文件下的server.xml 2:<Connector port="8080" URIEncoding="utf-8&q ...
- window.location.href/replace/reload()--页面跳转+替换+刷新
一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_g ...
- 5. window.location.href/replace/reload()--页面跳转+替换+刷新
1.window.location=url; window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面. 一.最外层top跳转页面,适合用于iframe框架集 ...
- js中的 window.location、document.location、document.URL 对像的区别(转载)
原文:http://www.cr173.com/html/18417_1.html 当我们需要对html网页进行转向的时候或是读取当前网页的时候可以用到下面三个对像: window.location. ...
- document.URL vs window.location.href All In One
document.URL vs window.location.href All In One document.URL 与 window.location.href 两者有啥区别 document. ...
随机推荐
- 013——VUE中多种方式使用VUE控制style样式属性
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- css11动态效果
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- fastjson缺陷--map转换json时出现$ref的情况
DisableCircularReferenceDetect来禁止循环引用检测: JSON.toJSONString(..., SerializerFeature.DisableCircularRef ...
- 字段值为NULL时的like注意事项
null like '%%'是有问题的 mysql中应该这样写COALESCE($ZU.mobile,'') like '%%' 或者 where IsNull([table].[column],'' ...
- Go语言的序列化与反序列化(gob)
encoding/gob包实现了高效的序列化,特别是数据结构较复杂的,结构体.数组和切片都被支持. 实现代码如下://定义一个结构体type Student struct { Name string ...
- 学习Java有没有什么捷径?
很多网友咨询学习Java有没有什么捷径,我说“ 无他,唯手熟尔 ”.但是愿意将一些经验写出来,以便后来者少走弯路,帮助别人是最大的快乐嘛! 要想学好Java,首先要知道Java的大致分类. 我们知道, ...
- 守护进程vs 守护线程
# #守护进程 from multiprocessing import Process import os,time,random def task(): print('%s is running' ...
- [QT] Tab键切换焦点顺序
在Qt Designer 中点击“编辑Tab顺序“按钮进入编辑Tab顺序模式,如下图: 之后界面会变成这样: 随处点击右键即可弹出菜单,选择 "制表符顺序列表..." 出现 剩下 ...
- HDU - 6314:Matrix (广义容斥)(占位)
Samwell Tarly is learning to draw a magical matrix to protect himself from the White Walkers. the ma ...
- Java程序员必须掌握的知识
1.语法:Java程序员必须比较熟悉语法,在写代码的时候IDE的编辑器对某一行报错应该能够根据报错信息 知道是什么样的语法错误并且知道任何修正. 2.命令:必须熟悉JDK带的一些常用命令及其常用选项, ...