Oops.. forgot to also include the on for stylesheets…

 

function IncludeStyleSheet(externalFile)

{

            document.write('<link rel="stylesheet" type="text/css" href="" Date() * 1+'"><\/script>');

}

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Ryan Gahl
Sent: Friday, March 31, 2006 1:45 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: RE: [Rails-spinoffs] refreshing JS libraries on client?

 

I have a global js function that handles this… always makes sure the parameter after the ? is new, therefore the file is always loaded new on the client…

 

…once you get your application to a stable “release” point though, maybe think about going back to the old way… because this could potentially fill up your users’ harddrives…

 

// use these functions to include references to extrenal files that might change frequently

// (main use is for testing... it's annoying to have to delete IE's temp files every time I make a change to a js or css file)

function IncludeScript(externalFile, defer)

{

            var deferStr = "";

            if (defer)

                        deferStr = 'defer="defer"';

            document.write('<script type="text/_javascript_" src="" Date() * 1+'" ' + deferStr + '><\/script>');

}

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Maninder, Singh
Sent: Friday, March 31, 2006 12:22 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: RE: [Rails-spinoffs] refreshing JS libraries on client?

 

In it's very simple form you can do this -

 

For first time include the js file like this -

<script src="" type="text/_javascript_"></script>

 

After updates include it like this -

<script src="" 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

 

The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.

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

Reply via email to