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

被折叠的 条评论
为什么被折叠?



