Re: How can I force clients to refresh JavaScript files?

2014-09-12 Thread Dean Lawrence

Try CF Static (http://cfstatic.riaforge.org/), it appends a unique string
to the end of the file requests, which forces browsers to load the newer
version. You can have it compress all your CSS and JS files or simply use
it deliver your files.

On Fri, Sep 12, 2014 at 11:05 AM,  wrote:


 I wonder why browsers caching Javascript and CSS files at least do not
 check if the date of the file on the server is still the same as the one in
 their cache.
 Since I implemented a Javascript errors log, I catch many errors showing
 that the old file in the cache was used days after the error was corrected,
 even with Google Bot! (yeah, Google Bot reads and executes scripts).

 This page :

 http://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files
 expose the problem and gives many solutions.

 I wonder if one could develop an even better solution using ColdFusion?
 Any ideas?


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359294
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: How can I force clients to refresh JavaScript files?

2014-09-12 Thread David Phelan

The easiest way is to simply expire the page using cfheader.  Take a look at 
http://www.bennadel.com/blog/1619-caching-coldfusion-pages-with-expires-header-value.htm.

David Phelan
Web Developer
IT Security  Web Technologies

Emerging Health
Montefiore Information Technology
3 Odell Plaza, Yonkers, NY 10701
914-457-6465 Office
dphe...@emerginghealthit.com
www.emerginghealthit.com
www.montefiore.org


From: =?ISO-8859-1?Q?Claude_Schn=E9egans schneegans@interneti=71?= 
=?ISO-8859-1?Q?ue.com=3E?=
Sent: Friday, September 12, 2014 11:05 AM
To: cf-talk
Subject: How can I force clients to refresh JavaScript files?

I wonder why browsers caching Javascript and CSS files at least do not check if 
the date of the file on the server is still the same as the one in their cache.
Since I implemented a Javascript errors log, I catch many errors showing that 
the old file in the cache was used days after the error was corrected, even 
with Google Bot! (yeah, Google Bot reads and executes scripts).

This page :
http://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files
expose the problem and gives many solutions.

I wonder if one could develop an even better solution using ColdFusion?
Any ideas?




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359295
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How can I force clients to refresh JavaScript files?

2014-09-12 Thread Claude Schnéegans

 Try CF Static (http://cfstatic.riaforge.org/), it appends a unique string
to the end of the file requests,

Ok, good technique.
But instead of downloading 262 files, I developped this simple CF_script custom 
tag:

CFSETTING ENABLECFOUTPUTONLY=Yes
CFSET scriptFile = expandPath(attributes.src)
CFIF fileExists(scriptFile)
   !--- get a timestamp from the file ---
   CFSET fileInfo = getFileInfo(scriptFile)
   CFSET timeStamp = dateFormat (fileInfo.lastModified, yymmdd)
  timeFormat(fileInfo.lastModified, HHmmss)
CFELSE
   CFOUTPUTFile #attributes.src# not found/CFOUTPUTCFABORT
/CFIF
CFOUTPUTSCRIPT type=text/javascript 
src=#attributes.src#?#timestamp#/SCRIPT
/CFOUTPUT
CFSETTING ENABLECFOUTPUTONLY=no

Then replace all like
script src=/commun/CSI_menu.js type=text/javascript/script
by
CF_script src=/commun/CSI_menu.js

It does the job.
I will probably develop the same for css files




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359296
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: How can I force clients to refresh JavaScript files?

2014-09-12 Thread Claude Schnéegans

 The easiest way is to simply expire the page using cfheader.

The problem with this technique is that you will force a reload even if the 
file was not changed.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359297
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm