您更喜欢哪种方式重新加载当前页面(使用按钮)?
1 <input type="button" value="Reload" onClick="history.go(0)">
2 <input type="button" value="Reload" onClick="location.reload(true)">
3 <input type="button" value="Reload" onClick="window.location.reload(true)">
4 <input type="button" value="Reload" onClick="window.location.href=window.location.href">
5 <input type="button" value="Reload" onClick="document.location.reload(true)">
6 <input type="button" value="Reload" onClick="document.location.href=document.location.href">
据我所知,由于页面的URL经常更改,因此需要类似于“回退函数”的功能。
<a href="urlOfCurrentPage.html" onclick="window.location.reload(true);return false;">Reload</a>
对我不起作用,对吗?
*.location.reload()
作为参数仅用于指定是否应忽略缓存。https://dev59.com/2Ggv5IYBdhLWcg3wDsnZ - Dead.Rabit