Take the 2-minute tour ×

I've got an application in which the Javascript is changing relatively rapidly; our testers have run repeatedly into the prroblem that a refresh of the page in IE and Firefox doesn't cause the new javascript to be loaded until the browser cache is cleared and the page is refreshed several times.

I'd like to set the exiration time on the javascript files to force them not to be cached, so they are reloaded every time the page is reloaded.

How can this be done?

share|improve this question
add comment

2 Answers

The best way to deal with this is to change the names of the javascript files each time you change them. Then it doesn't matter if they get cached. An alternative is to create a filter to set the cache-control header.

I've seen questions like this on stackoverflow and serverfault - might be a good idea to search there. Seems more suited to those sites.

share|improve this answer
Not to be cranky, but what part of "tomcat" did I leave out of the title? –  Charlie Martin Nov 13 '10 at 5:06
add comment

Serve the CSS up from an apache server and use the mod_expiry to set the expiry. You can do this will all your static content.

share|improve this answer
add comment

Your Answer


