• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat & javascript browser caching

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic