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 对象中生 ...
随机推荐
- hdu 5730 Shell Necklace——多项式求逆+拆系数FFT
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5730 可以用分治FFT.但自己只写了多项式求逆. 和COGS2259几乎很像.设A(x),指数是长度,系数 ...
- 获取sonar扫描结果
api通过抓包获取 java 1.get和post方法 package com.tools.httpUtil; import java.io.BufferedReader; import java.i ...
- 配置和启动脚本(bash shell学习01)
bash是 Bourne Again Shell简称 ,从unix系统的sh发展而来 查看当前shellecho $SHELL查看系统支持的shellcat /etc/shells cd /binls ...
- Docker -- resolve "join node timeout" error
在worker节点机器上通过docker swarm join 到 manger node时,报Timeout错误,如下: Error response from daemon: Timeout wa ...
- USB设备驱动总结
现象:把USB设备接到PC (韦老师总结) 1. 右下角弹出"发现android phone" 2. 跳出一个对话框,提示你安装驱动程序 问1. 既然还没有" ...
- WCF服务端返回:(413) Request Entity Too Large
出现这个原因我们应该都能猜测到,文件传出过大,超出了WCF默认范围,那么我们需要进行修改. 服务端和客户端都需要修改. 第一.客户端: <system.serviceModel> < ...
- Populating Next Right Pointers in Each Node II ?
void connect(TreeLinkNode *root) { if(root==NULL) return; if(root->left&&root->right) ...
- 如何发布可用于azure的镜像文件
摘要:本篇文章讲述如何将蝉知,禅道和然之发布azure的镜像. azure是微软提供的云服务平台.并且针对中国用户专门开通了www.windowsazure.cn站点.同时还成了微软开放中国公司,推出 ...
- No mapping found for HTTP request with URI [/jiaoyu/student/add] in DispatcherServlet with name 'SpringMVC'
项目是使用spring MVC (1)在浏览器中访问,后台总报错: No mapping found for HTTP request with URI [/exam3/welcome] in Dis ...
- Maven整合SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
使用SSM(Spring.SpringMVC和Mybatis)已经有三个多月了,项目在技术上已经没有什么难点了,基于现有的技术就可以实现想要的功能,当然肯定有很多可以改进的地方.之前没有记录SSM整合 ...