Forum Moderators: open

Message Too Old, No Replies

how to cache the pictures getting download

caching

         

rsennat

11:08 am on Nov 22, 2005 (gmt 0)



hi all,

i have some pictures in the server uner cgi-bin directory. using a script i view the pictures in the browser and see that every time, its getting downloaded from the server. how to cache the pictures and aviod doanloading from the server again and again.

thanks
rsennat

JAB Creations

6:53 pm on Nov 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi rsennat and welcome to WebmasterWorld.

I think this issue has more to do with the user's browser. I would suggest making access to content which you may find using more bandwidth then you'd like to see a bit more restrictive.

It may be possible to do something with...
JavaScript...
[webmasterworld.com...]

...or the HTTP sever software you're using (such as Apache).

tedster

2:48 am on Nov 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



JAB is right. Whether to use a cached version of a file or make another server request is a browser setting -- and under the user's control.

IE's default setting (which will be what most users have) is to check for new versions "automatically" rather than "every time". This means that, for most users, there should only be a new trip to the server if the expiration time set for the IE cache has expired since the last download. This behavior is always overridden by an intentional refresh or direct instruction to get a file -- and I'm guessing that your script is a direct instruction rather than going through the IE shell.

jdMorgan

3:48 am on Nov 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is also possible that the server is returning a no-cache header or a very short or 'instant' Expires header on the image files, in which case an HTTP-compliant browser will not cache the images.

It would be worthwhile to use a server headers checker to make a request, and see what Cache-control and Expires header info the server is returning.

Jim

tedster

6:08 am on Nov 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jdMorgan sent me these two reference links that are very helpful for sorting out caching issues:

Caching Tutorial for Web Authors and Webmasters [mnot.net]
Cacheability Checker [ircache.net]

Thanks!

rsennat

10:18 am on Nov 24, 2005 (gmt 0)



hi,
i tried reading through the links you gave.
and tried few stuff like this,

print "Cache-Control: max-age=600 must-revalidate\n";
print "Expires: Thu, 29 Nov 2005 17:04:19 GMT\n";
print header;

in the Perl /CGI scripts.
This caches the whole page and further requests are not given to server. So this creates a serious problem.

Only the images that i use in my scripts to be displayed has to be cached.

please help me on this.

thanks
rsennat