[英]Clear cache on page refresh using javaScript or jquery
My Webpage http://avocettechnologies.com/avocetiq/ works fine when it loads the first time but when i click refresh button or reload page it won't load fully(The into part the transition of mobile and stuff) specially in Chrome, if i press ctrl + f5 it'll work fine 我的网页http://avocettechnologies.com/avocetiq/在第一次加载时工作正常,但是当我点击刷新按钮或重新加载页面时,它将无法完全加载(部分是移动和东西的过渡),特别是在Chrome中,如果我按ctrl + f5它会工作正常
so i want to clear cache whenever page refresh or reload is done or is there any better solution for this 所以我想在页面刷新或重新加载时清除缓存,或者是否有更好的解决方案
i tried the following code but it keeps loading the page 我尝试了以下代码,但它继续加载页面
<script> window.onload = function() { if(!window.location.hash) { window.location = window.location + '#loaded'; window.location.reload(); } } </script>
` `
My Website is in angularjs 我的网站是angularjs
Thank You 谢谢
默认情况下,reload()方法从缓存重新加载页面,但您可以通过以下方式强制它从服务器重新加载页面:
location.reload(true)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.