In it's very simple form you can do this -
 
For first time include the js file like this -
<script src="scripts/prototype.js?v=1" type="text/javascript"></script>
 
After updates include it like this -
<script src="scripts/prototype.js?v=2" type="text/javascript"></script>
 
Keep bumping up the version number.
 
Now there are lots of better ways of doing this and creating automated 
versioning by checking the md5 of the file etc etc, but this should solve your 
problem.
 
Thank you,
Mandy.

________________________________

From: [EMAIL PROTECTED] on behalf of Rahul Bhargava
Sent: Fri 3/31/2006 11:48 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] refreshing JS libraries on client?



Hi folks,

 

So I've got this app built on prototype, with a bunch of extra JS classes to do 
what we want.  Now the problem is, when I make a change to one of those JS 
files (or an upgrade to prototype itself), how do I ensure that the client 
browsers refresh their cache with the latest JS?

 

Clearly I want the browse to cache the large JS files, but I also want that 
cache to expire at some point, or I want to be able to force a re-fetch of all 
the scripts/css referred to (the equivalent of a shift-reload).

 

This must be a solved problem, but I didn't see the solution anywhere... do I 
stick something in the http header of the JS file?

 

Thanks for any assistance,

 

Rahul

 

<<winmail.dat>>

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to