1

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

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

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. 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. 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, Commented Aug 12, 2016 at 10:56

1 Answer 1

5

By 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)
Sign up to request clarification or add additional context in comments.

3 Comments

@Ashoke Kumar thanks for your time, i added that in may header tag but when i reload the page still same problem
add this in to your meta field<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
you may please put a version number in the jquery file ie. filename.js?v=1 ,in each time the incremented the version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.