1

I tried to ran any HTML file in chrome.

When I do some changes in the JS code then the chrome doesn't refresh the data.

It is only working if I press 20-25 refresh

I tried also to delete catch.

Do you have any idea how I can fix the refresh at chrome ?

James Hill
  • 56,052
  • 18
  • 138
  • 155
user1365697
  • 5,093
  • 10
  • 47
  • 80

3 Answers3

1

There are several ways to clear/bust a cache. This is not a Chrome specific issue.

If your testing in Chrome, I suggest using an Incognito window. Incognito windows won't use any stored or cached content and work very well for testing.

See this thread for additional information.

Community
  • 1
  • 1
James Hill
  • 56,052
  • 18
  • 138
  • 155
1

My usual solution is to add a version number to the script link :

<script src="thelib.min.js?v=32"></script>

I increment the version only when I change the js file. So I'm sure it can be cached if it didn't change and it is updated in browsers having refresh problem (like Chrome).

Denys Séguret
  • 335,116
  • 73
  • 720
  • 697
  • I use this method at times too. It's bothersome though when you're authoring a .js file and are making multiple incremental changes that need tested. Pretty soon, you're at `*.js?3789` :) – James Hill Oct 14 '12 at 13:36
0

Chrome is pretty notorious for caching stuff. (Part of the reason it's so quick).

As well as the Random number added to the file (As Suggested in an earlier answer). Try turning off the cache via the dev tools.

Disabling Chrome cache for website development

Community
  • 1
  • 1
LiamB
  • 17,263
  • 19
  • 72
  • 112