转自: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的区别的更多相关文章

  1. window.location.href和document.location.href、document.URL的区别

    1.document表示的是一个文档对象,window表示的是一个窗口对象,一个窗口下可以有多个文档对象. 所以一个窗口下只有一个window.location.href,但是可能有多个documen ...

  2. window.location.href 和 document.location.href

    document表示的是一个文档对象,window表示的是一个窗口对象,一个窗口下可以有多个文档对象. 所以一个窗口下只有一个window.location.href,但是可能有多个document. ...

  3. windows.open window.location.href的用法和区别

    window.location.href  只能在当前页面打开,不能用新窗口打开 windows.open("URL","窗口名称","窗口外观设定& ...

  4. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法与区别(跳出iframe方法)

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  5. 解决document.location.href下载文件时中文乱码

    1:tomcat 安装路径下 找到 conf文件下的server.xml 2:<Connector port="8080" URIEncoding="utf-8&q ...

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

    一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_g ...

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

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

  8. js中的 window.location、document.location、document.URL 对像的区别(转载)

    原文:http://www.cr173.com/html/18417_1.html 当我们需要对html网页进行转向的时候或是读取当前网页的时候可以用到下面三个对像: window.location. ...

  9. document.URL vs window.location.href All In One

    document.URL vs window.location.href All In One document.URL 与 window.location.href 两者有啥区别 document. ...

随机推荐

  1. JAVA代码反编译笔记

    最近有个朋友说有个java弄的软件是从朋友处拿来的,由于进行了网卡地址绑定,不修改网卡地址无法使用,叫我看看有无办法破解,之前都很少玩这些东西,本着帮忙的心态,尝试了下,便有了一下的笔记内容. 1.使 ...

  2. pg_test_fsync使用记录

    pg_test_fsync pg_test_fsync旨在让您合理地了解特定系统上最快的wal_sync_method,以及在发生识别的I / O问题时提供诊断信息. 但是,pg_test_fsync ...

  3. Ubuntu語言支持爲灰色修復方法

    Ubuntu語言支持爲灰色修復方法 在Ubuntu12.04中,在下不知爲何將 語言支持 中 應用到整個系統 和 添加語言 這2個按弄成了灰色,導致ibus不能輸入中文,現在唔將修復方法公告天下: 1 ...

  4. C++中标准输入流cin与Ctrl+Z使用时的问题

    今天使用C++编写了一段小程序,练习使用标准库的算法,代码如下: #include <iostream> #include <algorithm> #include <v ...

  5. Win7系统64位环境下使用Apache——Apache2.4整合Tomcat与mod_jk

    转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/70398091 本文出自[我是干勾鱼的博客] 之前的几篇文章: Win7系统64位 ...

  6. Android 仿淘宝属性标签页

    直接看效果图相信这样的效果很多,我之前在网上找了很久没找到自己想要的! <?xml version="1.0" encoding="utf-8"?> ...

  7. 修改maven仓库位置

    在eclipse中安装好maven2的插件后: 第一步: 默认会放在~/.m2/repository目录下 (“~”代表用户的目录,比如windows7下一般都是C:\Users\zz\.m2\rep ...

  8. 【django】Bootstrap 安装和使用

    官网 下载:推荐下载源码包 安装Bower:使用Bower安装并管理 Bootstrap 的Less.CSS.JavaScript和字体文件(通过npm安装bower) npm install -g ...

  9. CentOS下安装w3m,及w3m的使用

    centos下安装软件的命令不是apt-get,而是yum,如果安装w3m,利用sudo yum install w3m w3m-img -y即可 △△△△△△△△如果你用的是centos或readh ...

  10. jstl错误排除:According to TLD or attribute directive in tag file, attribute value does not accept any expressions

    问题描述: 在 JSP 页面中使用 JSTL 标签库,访问 JSP 页面时抛出了如下异常信息: org.apache.jasper.JasperException: /index.jsp (line: ...