Caching of javascript and stylesheets

Is there a standard way to make sure a client’s web browser pulls the
latest version of your style sheet or javascript file instead of using a
cached one? We are currently using a tedious way where we add a
version number to the file (e.g. screen-v12.css) and when Rails boots up
it finds the latest version in the style sheet folder. On the other
hand, I have seen Basecamp append some kind of query string to the
include href, e.g. href="/stylesheets/screen.css?1147466741". Not sure
what their logic is for coming up with that query string parameter.

Anyway, it would be nice if there were some standard way to deal with
this problem. Is there one? What are other people doing?

thanks,
Jeff

There a plugin called asset_timestamping which will do what you want.
Harvey

On 25/5/06 15:55, “Jeff C.” [email protected] wrote:

this problem. Is there one? What are other people doing?

thanks,
Jeff

This e-mail has been scanned for all viruses by MessageLabs.

Harvey B. wrote:

There a plugin called asset_timestamping which will do what you want.
Harvey

Actually this asset timestamping ability is built into Rails now, since
actionpack 1.12.1, I believe. Unfortunately, there’s not a very fine
grain of control over it (it’s either on for everything, or nothing),
but it’s there nonetheless.

Here is an excellent blog post on it:

http://hypsometry.com/blog/on-browser-caching-asset-timestamping-and-rails

  • Danny

Danny
Thanks for the info
Harvey

On 25/5/06 16:24, “Daniel B.” [email protected] wrote:

Here is an excellent blog post on it:

http://hypsometry.com/blog/on-browser-caching-asset-timestamping-and-rails

  • Danny

This e-mail has been scanned for all viruses by MessageLabs.