user1365697
user1365697

Reputation: 5989

Issue in chrome with javascript

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 ?

Upvotes: 1

Views: 94

Answers (3)

LiamB
LiamB

Reputation: 18586

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

Upvotes: 0

Denys Séguret
Denys Séguret

Reputation: 382132

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).

Upvotes: 1

James Hill
James Hill

Reputation: 61792

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.

Upvotes: 1

Related Questions