admin管理员组文章数量:1403071
My Webpage / 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
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 Webpage http://avocettechnologies./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
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
Thank You
Share Improve this question edited Aug 12, 2016 at 11:19 Mr Robot asked Aug 12, 2016 at 8:07 Mr RobotMr Robot 8975 gold badges21 silver badges47 bronze badges 3- please explain a bit more because "page won't load fully" is not enough to answer this question. Try to post some more relevant code. – Yogesh Commented Aug 12, 2016 at 8:42
- I think you would be better implementing a correct caching mechanism, rather than manually trying to refresh the cache every single time. Set correct caching headers for your different resources. You will want to cache 3rd party JS/CSS for example. Set correct expires headers. And set no-cache on resources you dont want the browsers to cache. Caching can great improve the Users Experience of your site, and reduce the load on your servers etc. Browser cache is no longer the only option either now. – ste2425 Commented Aug 12, 2016 at 9:18
- @ste2425, yogesh I have updated the post with website url, in home page the intro trasition will work fine but not after refresh or reload, – Mr Robot Commented Aug 12, 2016 at 10:56
1 Answer
Reset to default 5By default, the reload() method reloads the page from the cache, but you can force it to reload the page from the server by :
location.reload(true)
本文标签: angularjsClear cache on page refresh using javaScript or jqueryStack Overflow
版权声明:本文标题:angularjs - Clear cache on page refresh using javaScript or jquery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744369990a2602972.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论