Summary on 20080717: web page refresh

本文探讨了多种网页刷新方式,包括使用window.location.reload、window.location.href、window.location.replace等方法,并对比了它们之间的区别及浏览器兼容性问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

These days I'm working on web page refresh, and find that there are lots of ways to refresh page:
1. window.location.reload(true/false)
2. window.location.href = window.location.href(url)
3. window.location.replace(URL)
4. document.execCommand('Refresh');

Why when refresh page, there will be confirmation window to ask for the confirmation:
http://hi.baidu.com/ouanan/blog/item/cdace608828832900b7b8226.html

Note that window.location.href = url won't work well on IE6 and Maxthon.
but window.location.reload() won't have this problem

Difference between reload and replace:
http://www.110xs.com/archiver/?tid-1592/

In short, the difference is that reload(true/false)will get value from server or cache depending on the value of the parameter.
however, for the replace method,IE will use the url to replace the content in cache,so after using this method, can't use back/forward button of IE to navigate between web page.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值