Forum

Posted by
Matthew Hardy  -  February 2010
Hey ya,

I have a script from the google api server which caches consistently on safari, and some fckeditor script with no problem.

But my own scripts are being mis-interpreted by safari and not cached.
The inspector says the file is transferred as javascript mime but safari says no it's not... and no cache, but sometimes it is interpreted as js, not enough to cache.

Has anyone got a tip on how to better deliver javascript for the purpose of caching?

cheers
 
oh, also the javascript header shows : Expires:Mon, 16 Feb 2009 04:14:53 GMT last year, but I have a header on the html document that happily says try to expire in a month. Expires:Tue, 16 Mar 2010 10:14:53 GMT

Not sure if this would be part of the issue... the google api js expires too but 15minutes prior...

If I serve the google api js from Roxen, it does not like to cache either...


 
Posted by
Tobias Liin  -  February 2010
Has anyone got a tip on how to better deliver javascript for the purpose of caching?


Have you tried using the Expires modifier module? If you are not afraid of overcaching, you can raise it based on glob patterns, e.g:

/javascript/*.js

Or if you are afraid of overcaching, but don't mind some server overhead, you could do something like this with prestates and file version number, and then you can set the expire time 100 years in the future and still not get overcaching:

<sb-block-dependencies>
  <emit source="dir" file="/javascript/click.js" notitle="">
    <set variable="var.revision" from="_.revision"/>
    <cache shared="yes" key="/javascript/click.js + &var.revision;">
     <script type="text/javascript" src="/(&var.revision;)/javascript/click.js"></script>
    </cache>
  </emit>
</sb-block-dependencies>
 
1
Search this thread: