location.replace()和location.href=进行跳转的区别
来源:互联网 发布:知柏地黄丸女童能吃吗 编辑:程序博客网 时间:2024/05/18 00:52
location.href 通常被用来跳转到指定页面地址;
location.replace 方法则可以实现用新的文档替换当前文档;
location.replace 方法不会在 history 对象中生成一个新的记录。当使用该方法时,新的 URL 将覆盖 history 对象中的当前记录。
前者不在浏览器中保存跳转前的网址,因此按返回键将无效 后者不存在这个问题 reload方法,强迫浏览器刷新当前页面 replace方法,通过指定URL替换当前缓存在历史里(客户端)的项目,因此当使用replace方法之后,你不能通过“前进”和“后退”来访问已经被替换的URL。 在实际应用的时候,重新刷新页面的时候,我们通常使用: location.reload() 或者是 history.go(0) 来做。。因为这种做法就像是客户端点F5刷新页面,所以页面的method="post"的时候,会出现“网页过期”的提示。那是因为Session的安全保护机制。
阅读全文
0 0
- location.replace()和location.href=进行跳转的区别
- location.replace()和location.href=进行跳转的区别
- location.replace()和location.href=,location.reload()的区别
- location.replace()和location.href=,location.reload()的区别 location.replace()和location.href=的区别
- location.replace()和location.href=的区别
- location.replace()和location.href=的区别
- Document.location.href和.replace的区别
- Document.location.href和.replace的区别
- Document.location.href和.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- window.location.href和window.location.replace的区别
- (转载)vi/vim基本使用方法(vi)(vim)(使用方法)
- 数组的添加和删除
- NSFileManager一般常用方法
- 取elecagreemodel表中 agreement_version 值最大的的协议号对应的协议名称,以及协议路径不为空的数据
- 缓存之EHCache(二)
- location.replace()和location.href=进行跳转的区别
- HDU6026(最短路)
- vector结构体排序与priority优先级队列自动排序对比
- 优盘病毒清理方法与预防措施
- nginx使用ngx.req.get_body_data()获取不到请求体内容
- 可重入内置锁
- Android插件收集
- 教你用Fiddler在电脑上抓手机上的包
- ios开发证书,描述文件,bundle ID的关系