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 对象中生 ...
随机推荐
- 用hexo搭建自己的blog
一.工具准备: 1.1 安装node 作用:用来生成静态页面的 到Node.js官网下载相应平台的最新版本,一路安装即可. 1.2 安装Git 作用:把本地的hexo内容提交到github上去. 安装 ...
- linux用netstat查看服务及监听端口
[root@localhost ~]# netstat -nlp netstat命令各个参数说明如下: -t : 指明显示TCP端口 -u : 指明显示UDP端口 -l : 仅显示监听套接字(所谓套接 ...
- Mouse without Borders 跨屏鼠标
Mouse without Borders 跨屏鼠标 软件方式 当你有几台电脑同时工作时,不停的换鼠标和键盘是非常不方便的. 如果用的 Mouse without Borders 就不一样了,可以在多 ...
- etcd使用经历
etcd是一个开源的.分布式的键值对数据存储系统,提供共享配置.服务的注册和发现.etcd与zookeeper相比算是轻量级系统,两者的一致性协议也一样,etcd的raft比zookeeper的pax ...
- maven环境配置详解,及maven项目的搭建及maven项目聚合
首先:Maven 3.2.1:不同版本中仓库中文件是不一样的,Maven运行,先找用户配置,再找全局配置 1. Maven全局配置:全局统一的配置文件,在maven的安装目录中 2. Maven用户配 ...
- POJ2142(扩展欧几里得)
The Balance Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 5991 Accepted: 2605 Descr ...
- 【转】Jmeter做web压力测试时设置持续时间注意点
头一回使用jmeter做web的压力测试,遇到个很莫名其妙的问题,不管我的线程组怎么设置,它就是执行一次就结束了. 设置循环次数为300,不使用调度器--〉执行一次就结束了,循环次数未生效 设置循环次 ...
- keytool生成JKS证书的详细步骤及截图
注:防止有不必要的空格,尽量不要复制粘贴 1. 依据CFCA所提供的CN生成密钥存储文件和密钥对(创建JKS证书库) keytool -genkey -v -alias slserver -keyal ...
- 关系数据库域关系演算语言QBE
QBE: Query By Example 基于屏幕表格的查询语言 查询要求:以填写表格的方式构造查询 用示例元素(域变量)来表示查询结果可能的情况 查询结果:以表格形式显示 QBE操作框架 ...
- 使用Kismet进行网络扫描
执行命令启动Kismet root@sch01ar:~# kismet 这个界面是用来设置颜色的,单击Yes按钮,默认颜色灰色 这个界面显示正在使用root用户运行Kismet工具,单击OK 这个界面 ...