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)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744369990a4570898.html
评论列表(0条)