Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .