I will make a change to my JS files but it won't really change in the browser, I have to rename the files every time so that it reloads it. Is there some sort of .htaccess command I can add or something to make it stop caching?
It is even caching my html pages hard core. I need to reopen my entire browser just to see changes. Could it possibly be a server problem?
A few ideas:
HEAD
command instead of a full GET to see if it needs to download the full file again, and the server uses the timestamp to see.If you want to disable caching on your server, you can do something like:
In .htaccess
add Something like
script.js?a=[random Number]
with the Random number generated by PHP.Have you tried expire=0, the pragma "no-cache" and "cache-control=NO-CACHE"? (I dunno what they say about Scripts).
When doing updates to my web applications I will either use a handler to return a single JS file to avoid the massive hits on my server, or add a small query string to them:
I know this is an "old" question. But the headaches with caching never are. After heaps of trial and errors, I found that one of our web hosting providers had through CPanel this app called Cachewall. I just clicked on Enable Development mode and... voilà!!! It stopped the long suffered pain straight away :) Hope this helps somebody else... R
Quick steps:
1) Open up the Developer Tools dashboard by going to the Chrome Menu -> Tools -> Developer Tools
2) Click on the settings icon on the right hand side (it's a cog!)
3) Check the box "Disable cache (when DevTools is open)"
4) Now, while the dashboard is up, just hit refresh and JS won't be cached!
Open Developer Tools
...
->More Tools
->Developer Tools
Click
Empty Cache and Hard Reload