Force browser to cache files

This is a discussion on Force browser to cache files within the Apache Web Server forums, part of the Web Server and Related Forums category; I want to send the browser some headers to force it to cache .js and ..css files. Is there any ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-09-2006
Hermann
 
Posts: n/a
Default Force browser to cache files

I want to send the browser some headers to force it to cache .js and
..css files.

Is there any way to configure apache to do this??

Thanks.

  #2 (permalink)  
Old 12-11-2006
shimmyshack
 
Posts: n/a
Default Re: Force browser to cache files


Hermann wrote:
> I want to send the browser some headers to force it to cache .js and
> .css files.
>
> Is there any way to configure apache to do this??
>
> Thanks.


ExpiresActive on
ExpiresByType application/x-javascript A86400
#possibly the mime-type should be the above, but if not then try
#ExpiresByType text/javascript A86400
ExpiresByType text/css A86400

or just ExpiresDefault A604800 if you want imeage html etc.. all
expired.

A[seconds] after Access,

just check the Temp Internet Dir for internet explorer to see if your
caching is working as you expect if you have no access to a proxy to
check the headers

see the manual for more.

  #3 (permalink)  
Old 12-11-2006
kisero
 
Posts: n/a
Default Re: Force browser to cache files

by default IE 6 caches css and js files...no need to do anything!

shimmyshack wrote:

> Hermann wrote:
> > I want to send the browser some headers to force it to cache .js and
> > .css files.
> >
> > Is there any way to configure apache to do this??
> >
> > Thanks.

>
> ExpiresActive on
> ExpiresByType application/x-javascript A86400
> #possibly the mime-type should be the above, but if not then try
> #ExpiresByType text/javascript A86400
> ExpiresByType text/css A86400
>
> or just ExpiresDefault A604800 if you want imeage html etc.. all
> expired.
>
> A[seconds] after Access,
>
> just check the Temp Internet Dir for internet explorer to see if your
> caching is working as you expect if you have no access to a proxy to
> check the headers
>
> see the manual for more.


  #4 (permalink)  
Old 12-11-2006
shimmyshack
 
Posts: n/a
Default Re: Force browser to cache files


kisero wrote:
> by default IE 6 caches css and js files...no need to do anything!
>


imho this is only the case when
tools->internet options->general->settings->never
is set, which is not the default, but even then it is best to force
every compliant browser to behave in a predictable way rather than
relying on a behaviour of a browser which can be changed or updated
without your consent.

Also IE has a caching bug which means that images (that you might use
for rollovers) wont be cached, and there can sometimes be an irritating
delay while a request is sent before the rollover changes, other
flashing background and so on can be fixed by sending IE6 the right
headers.

  #5 (permalink)  
Old 12-11-2006
kisero
 
Posts: n/a
Default Re: Force browser to cache files

well, i did this test yesterday with the default configurations. (on
IE) and of course the web server was not sending any cache headers back
to the client to make sure nothing was forced.

me!

shimmyshack wrote:

> kisero wrote:
> > by default IE 6 caches css and js files...no need to do anything!
> >

>
> imho this is only the case when
> tools->internet options->general->settings->never
> is set, which is not the default, but even then it is best to force
> every compliant browser to behave in a predictable way rather than
> relying on a behaviour of a browser which can be changed or updated
> without your consent.
>
> Also IE has a caching bug which means that images (that you might use
> for rollovers) wont be cached, and there can sometimes be an irritating
> delay while a request is sent before the rollover changes, other
> flashing background and so on can be fixed by sending IE6 the right
> headers.


 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:07 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0