当前页面的 JavaScript 硬刷新
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2099201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JavaScript hard refresh of current page
提问by leepowers
How can I force the web browser to do a hard refresh of the page via JavaScript?
Hard refresh means getting a fresh copy of the page AND refresh all the external resources (images, JavaScript, CSS, etc.).
如何强制 Web 浏览器通过 JavaScript 对页面进行硬刷新?
硬刷新意味着获取页面的新副本并刷新所有外部资源(图像、JavaScript、CSS 等)。
回答by CMS
Try to use:
尝试使用:
location.reload(true);
When this method receives a truevalue as argument, it will cause the page to always be reloaded from the server. If it is false or not specified, the browser mayreload the page from its cache.
当此方法接收一个true值作为参数时,它将导致页面始终从服务器重新加载。如果为 false 或未指定,浏览器可能会从其缓存中重新加载页面。
More info:
更多信息:
回答by Gsp Ivan
window.location.href = window.location.href

