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.

  • 相关阅读:
    Doing Homework 简单dp&&状态压缩
    嫖裤子序列
    王宁宁宁
    友军寻路法
    Viviani
    ccf 201909-3
    ccf 201909-5
    链式前向星
    ccf-201909-04
    ccf -201909-2
  • 原文地址:https://www.cnblogs.com/imust2008/p/5053869.html
Copyright © 2011-2022 走看看