Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes Tomcat & javascript browser caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat & javascript browser caching" Watch "Tomcat & javascript browser caching" New topic
Author

Tomcat & javascript browser caching

Konstantin Netkachev
Greenhorn

Joined: Jul 24, 2009
Posts: 15
Our Java web application works on Tomcat 6. Most of user use FireFox.

We faced a problem. After changing javascript files on server, they allways taken from browser cache on client side and doesn't updated auromaticaly from server. Only CTRL+F5 resolves that but users don't know it and allways swear at errors.

Is there possibility to somehow resolve this problem? May be to change some tomcat configurations?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

You can control client caching by adjusting the cache headers sent back with the response to the JavaScript resource requests, up to and including "no-cache". You can force a change by including a version ID as part of the URL, since caching is based on the URL itself and not on the returned content.

For production systems, cache is generally preferable, since things like JavaScript, CSS, and many images are not usually very changeable. In cases where you are dynamically creating the contents of the returned JavaScript, that's another matter.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tomcat & javascript browser caching
 
Similar Threads
Problem with Work folder
Resolution Detection with JSP
how to create timer in jsp?
I didn't understood the term javascript Engine, What does it mean.
JavaScript help needed!