Force-refreshing only JavaScript files in Firefox and Chrome

I do this myself for development. I use Ctrl+F5. It's like a force refresh. This refreshes the page including re-downloading any referenced JavaScript files or CSS files even if they were cached.

It will NOT clear anything else such as your browsing history.

But please note that although I know this works in Firefox, and probably Internet Explorer, I am not sure if Ctrl+F5 works the same way in Chrome.

Also, iegik says:

On some browsers you can use `Ctrl+Shift+R to do the same task.


With Chrome:

Starting with Chrome 15, open the Developer Tools, click on the cogwheel at bottom left of the screen, and select the checkbox Disable cache.

Disable cache in Chrome 15 and up

This way, you will be sure that resources are always reloaded from the server, and you don't have to manually clear the cache, which might also remove cached data for unrelated sites.


I disagree with @7wp. Since some of your end users aren't familiar with the Ctrl+F5 function, and some aren't even aware of the differences between browsers and even the existance of other browsers (elders for example) you should force the browser to download a new copy of the JS/CSS files.

The best solution here is to add the timestamp at the end of the .js/.css filenames, or add the svn version which is a great idea too.

<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>

You might want to try clearing just your cache, and not your entire browsing, history, cookies, passwords, saved form data, and whatnot (the default).

In Firefox 3.5, go to

Tools » Clear Recent History...

Then make sure only "Cache" is selected before selecting "Clear Now."

In Chrome (don't know what particular version you're using, as I use the dev builds), go to

Wrench Icon (Tools) » Options » Personal Stuff tab » Clear browsing data...

Again, make sure only "Empty the cache" is checked.

Alternatively, you can try opening up a new Private session in Firefox or Incognito window in Chrome; neither should cache any files (including your .JS files) you automatically download and process when browsing.