JavaScript hard refresh of current page

跟風遠走 提交于 2019-11-26 04:10:56

问题


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.).


回答1:


Try to use:

location.reload(true);

When this method receives a true value as argument, it will cause the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.

More info:

  • The location object



回答2:


window.location.href = window.location.href


来源:https://stackoverflow.com/questions/2099201/javascript-hard-refresh-of-current-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!