from https://dev.opera.com/articles/efficient-javascript

Occasionally, it is necessary to change the page address using a script. The typical way to do this is by assigning a new address to location.href. This adds a history entry, and loads a new page, in the same way as activating a normal link.

In some cases, this extra history entry is unwanted, as the user will not need to go back to the earlier page. This is particularly useful if working in a situation where memory usage is critical. The memory used by the current page can be recovered by replacing the history entry instead. This is done using thelocation.replace() method.

location.replace('newpage.html');

Note that the page may still remain in cache, and may use memory there, but this will not be quite so much as if it were also kept in history.

location.replace() keeps the history under control的更多相关文章

  1. js 页面刷新location.reload和location.replace的区别小结

    reload 方法,该方法强迫浏览器刷新当前页面. 语法: location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取当前 ...

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

    有3个html页面(.html, .html, .html). 进系统默认的是1.html ,当我进入2.html的时候, .html里面用window.location.replace(" ...

  3. 【js 方法】js 页面刷新location.reload和location.replace的区别 【转】

    [转]:http://zccst.iteye.com/blog/2162658 reload 方法,该方法强迫浏览器刷新当前页面. 语法: location.reload([bForceGet]) 参 ...

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

    简单说说:有3个jsp页面(1.jsp,  2.jsp,  3.jsp). 进系统默认的是1.jsp ,当我进入2.jsp的时候, 2.jsp里面用window.location.replace(&q ...

  5. Coursera SDN M1.1 SDN History: Central Control

    source Structure 1.讨论SDN的时间线,从1980s至今. 2.认识到SDN背后的原则和idea. 3.识别SDN起源的架构主题. NOTE Four Chapter in SDN ...

  6. location.assign 与 location.replace的区别

    window.location.assign(url) : 加载 URL 指定的新的 HTML 文档. 就相当于一个链接,跳转到指定的url,当前页面会转为新页面内容,可以点击后退返回上一个页面. w ...

  7. location.reload() 和 location.replace()的区别和应用

    首先介绍两个方法的语法: reload 方法,该方法强迫浏览器刷新当前页面.语法: location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 fals ...

  8. Android webview “location.replace” 不起作用

    js解决方法: function locationReplace(url){ if(history.replaceState){ history.replaceState(null, document ...

  9. location.replace()和location.href=进行跳转的区别

    location.href 通常被用来跳转到指定页面地址;location.replace 方法则可以实现用新的文档替换当前文档;location.replace 方法不会在 history 对象中生 ...

随机推荐

  1. 系列文章--SharePoint 2013 开发教程

    做了SharePoint有三年了,大家经常会问到,你的SharePoint是怎么学的,想想自己的水平,也不过是初级开发罢了.因为,SharePoint开发需要接触的东西太多了,Windows操作系统. ...

  2. Oracle终极数据恢复,孰弱孰强(DUL vs AUL)

    这几天在帮朋友作数据恢复,由于已经到了无可救药的地步,只能使用终极手段进行恢复,直接从文件中读取数据进行恢复. 在恢复过程中反复对比了DUL和dcba的AUL,感觉到了两者的不同. DUL在处理文件损 ...

  3. Raid 技术简介

    独立硬盘冗余阵列(RAID, Redundant Array of Independent Disks),旧称廉价磁盘冗余阵列,简称硬盘阵列.其基本思想就是把多个相对便宜的硬盘组合起来,成为一个硬盘阵 ...

  4. Eclipse执行import命令导入maven项目时报错:Add a version or custom suffix using "Name template" in "Advanced" settings

    新建了两个maven项目在E盘workspace目录,后面移到workspace/app_engine目录下提交svn,再通过Eclipse的File->import导入时报错了: Projec ...

  5. python3 安装 past 包

    python3 安装 past 包 $ pip install future 错误现象 缺乏包的引用 from past.types import unicode 参考链接 https://pypi. ...

  6. 【转】WINSOCKET客户端编程以及JMETER外部调用

    1 public class SocketClient { 2 OutputStream clientout = null; 3 InputStream clienIn = null; 4 byte[ ...

  7. jmeter中50%70%80%90%代表的含义

    参考 http://www.cnblogs.com/jackei/archive/2006/11/11/557972.html 我的理解是: 在4.08秒响应时间内有50%的用户达到这个4.08的标准 ...

  8. 权益保护-知识产权:知识产权(IP)百科

    ylbtech-权益保护-知识产权:知识产权(IP)百科 知识产权,也称其为“知识所属权”,指“权利人对其智力劳动所创作的成果和经营活动中的标记.信誉所依法享有的专有权利”,一般只在有限时间内有效.各 ...

  9. 杂项-操作系统-百科:Solaris

    ylbtech-杂项-操作系统-百科:Solaris Solaris (读作 /se'laris:/ 或者 /so'le:ris/)是Sun Microsystems研发的计算机操作系统.它被认为是U ...

  10. python开发函数进阶:递归函数

    一,什么叫递归 #递归#在一个函数里调用自己#python递归最大层数限制 997#最大层数限制是python默认的,可以做修改#但是我们不建议你修改 例子和尚讲故事 #!/usr/bin/env p ...