I am facing an issue that is driving me insane. I have one and only one js file called template2.js in my js folder. I keep overwritting this file when I make modifications to my script. I am saving the file properly, but when I am testing my "pages" in the browser, I see in the Chrome debuger that an older version of that js file is taken into account. And that older version does not exist anymore as I have overwritten it. Hope someone can help me understanding what's going on.
-
1Have you tried clearing the browser cache? And how do you know it's the older version, if you're over-writing with the same name each time? – David Thomas Feb 01 '12 at 13:28
-
1This will sound crazy, but it works - I do it all the time. Ctrl F5 is meant to do a full refresh, without using the cache, but it doesn't refresh some included files (mainly script files). Hold Ctrl and press F5 3 or 4 times. It forces it to do it correctly. Crazy, but true. – Reinstate Monica Cellio Feb 01 '12 at 13:30
-
Hello David. Thank you to take time to try help me out. I quit the browser and restarted it several times. I know it is an older version because as when I check "scripts" in the Chrome debugger, the content is not the same of the actual file content. – Marc Feb 01 '12 at 13:30
-
try CTRL+F5 to refresh cache from web. Another tip is to add a queryatring variable to your javascript file. ex: template2.js?v=
ore another variable.. – stian.net Feb 01 '12 at 13:31 -
Hello Archer. Thanks for the tip. I am using mac. Do you know the key combination for mac? – Marc Feb 01 '12 at 13:31
-
1Going to `chrome://settings/clearBrowserData` and clearing the cache by hand will guarantee that it's been cleared. – jabclab Feb 01 '12 at 13:33
-
1Send out headers that tell chrome not to cache anything. – RedX Feb 01 '12 at 13:34
-
I clicked on the refreshed button as suggested and it works! Thank you guys for the help :) – Marc Feb 01 '12 at 13:36
-
ctrl+shift+del -> enter -> F5 – Thierry Ybt Feb 01 '12 at 13:37
-
Hello RedX how to set header to tell the browser not to cache anything? – Marc Feb 01 '12 at 13:37
-
1header("Cache-Control: no-cache, must-revalidate"); – Thierry Ybt Feb 01 '12 at 13:39
-
a real bad way I fix this with my css files is to add `http://site.com/some.css?`. You could try it with the script tag's src...But it's a really bad way to do it. – d-_-b Sep 19 '12 at 03:52
-
Looks like this is (give or take) a dupe -- pretty good discussion (and answer) here: http://stackoverflow.com/a/11786277/1028230 The CacheKiller extension sounds like money if it works as advertised. – ruffin Jan 13 '14 at 16:12
2 Answers
When you open chrome developer toolbar, there's a cog-icon on the bottom right corner. Clicking that should open a black panel. That panel has a "Disable cache" checkbox under network-tab.
Other option would be to manually go clear the cache from preferences -> under the hood -> clear browsing data.
If you do more development using chrome, I'd just disable the cache. Saves a lot of time lost wondering about why things don't work and realizing it's the cache that didn't refresh properly.

- 5,083
- 3
- 32
- 39
-
3Now you'll find it under the "Network conditions" tab — also at the bottom of the developer panel, next to the "Console" tab. If it's not there, click "..." icon to show that tab. – Tom Aug 15 '18 at 11:10
Depending on what browser you are using, you can load a page without cache by holding certain keys. See this answer on SuperUser for the correct combos: https://superuser.com/questions/278553/does-holding-down-ctrl-shift-while-clicking-refresh-actually-have-an-effect-in-m