zoukankan      html  css  js  c++  java
  • location.replace() keeps the history under control

     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.

  • 相关阅读:
    OpenCV之设计模式
    ca
    BMP结构详解
    Lucas–Kanade光流算法学习
    卡尔曼
    hash+链表
    文件操作
    查找
    fseek效率
    大家都说3C直连网络,3C网络是指什么呢?
  • 原文地址:https://www.cnblogs.com/imust2008/p/5053869.html
Copyright © 2011-2022 走看看