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.
location.replace() keeps the history under control的更多相关文章
- js 页面刷新location.reload和location.replace的区别小结
reload 方法,该方法强迫浏览器刷新当前页面. 语法: location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取当前 ...
- window.location.href和window.location.replace的区别
有3个html页面(.html, .html, .html). 进系统默认的是1.html ,当我进入2.html的时候, .html里面用window.location.replace(" ...
- 【js 方法】js 页面刷新location.reload和location.replace的区别 【转】
[转]:http://zccst.iteye.com/blog/2162658 reload 方法,该方法强迫浏览器刷新当前页面. 语法: location.reload([bForceGet]) 参 ...
- window.location.replace和window.location.href的区别
简单说说:有3个jsp页面(1.jsp, 2.jsp, 3.jsp). 进系统默认的是1.jsp ,当我进入2.jsp的时候, 2.jsp里面用window.location.replace(&q ...
- Coursera SDN M1.1 SDN History: Central Control
source Structure 1.讨论SDN的时间线,从1980s至今. 2.认识到SDN背后的原则和idea. 3.识别SDN起源的架构主题. NOTE Four Chapter in SDN ...
- location.assign 与 location.replace的区别
window.location.assign(url) : 加载 URL 指定的新的 HTML 文档. 就相当于一个链接,跳转到指定的url,当前页面会转为新页面内容,可以点击后退返回上一个页面. w ...
- location.reload() 和 location.replace()的区别和应用
首先介绍两个方法的语法: reload 方法,该方法强迫浏览器刷新当前页面.语法: location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 fals ...
- Android webview “location.replace” 不起作用
js解决方法: function locationReplace(url){ if(history.replaceState){ history.replaceState(null, document ...
- location.replace()和location.href=进行跳转的区别
location.href 通常被用来跳转到指定页面地址;location.replace 方法则可以实现用新的文档替换当前文档;location.replace 方法不会在 history 对象中生 ...
随机推荐
- Pycharm简单使用教程
转自https://blog.csdn.net/qq_40130759/article/details/79421242 1.下载pycharm pycharm是一种Python IDE,能够帮助我们 ...
- 【Spring】Junit加载Spring容器作单元测试(整理)
[Spring]Junit加载Spring容器作单元测试 阅读目录 >引入相关Jar包 > 配置文件加载方式 > 原始的用法 > 常见的用法 > 引入相关Jar包 一.均 ...
- 如何调试Excel VBA代码
Excel VBA出错时给出的错误信息极少,需要充分利用各种工具来进行调试. 1.编译错误 常见的编译错误有: 错误的源代码格式,比如if后面缺少then:在编辑器中该行会变成红色. 错误的语法结构, ...
- checkStype和findBugs校验
IDEA可以直接在setting中下载checkStyle和findBugs <plugin> <groupId>org.codehaus.mojo</groupId&g ...
- PDF通过剪裁来实现打印字体变大
之前打印论文,很多都是一页两版,这个时候字体会非常小:打印缩放放大后,字又容易出了打印边界. 这种情况可以采用Adobe IX Pro(只要是pro应该都可以)进行边缘裁剪来实现字体放大.只需要剪裁( ...
- 通过IHttpModule,IHttpHandler扩展IIS
IIS对Http Request的处理流程 当Windows Server收到从浏览器发送过来的http请求,处理流程如下(引用自官方文档): 最终请求会被w3wp.exe处理,处理过程如下: 左边蓝 ...
- junit基础学习
学习地址一:http://blog.csdn.net/andycpp/article/details/1327147/ 学习地址二:http://blog.csdn.net/zen99t/articl ...
- C#去除数组空格
static void Main(string[] args) { "}; Console.WriteLine("输出带有空字符串的数组:"); foreach (str ...
- 安装S_S相关报错的troubleshooting
在安装S_S server时,在Debian上会出现类似如下的报错: File , in <module> sys.exit(main()) File , in main config = ...
- 蓝桥杯 算法训练 ALGO-34 纪念品分组
算法训练 纪念品分组 时间限制:1.0s 内存限制:256.0MB 问题描述 元旦快到了,校学生会让乐乐负责新年晚会的纪念品发放工作.为使得参加晚会的同学所获得的纪念品价值 相对均衡,他要把购 ...