| re: Web App Image Caching
Giggle Girl wrote:[color=blue]
> Hello,
> I am helping to design a web application that uses 167 little icons on
> various pages in a framed environment. As is, the app loads each icon
> on a page by page basis, and if an image changes (like a "plus" becomes
> a "minus" when a folder icon is expanded) is does a
>
> document.all[img].src="picsV/minus.gif"
>
> which I am pretty sure goes and grabs the image at that moment, making
> no use of caching images at all.[/color]
You have a wrong idea of how the browser cach is working.
Say you have an image "http://www.myserver.com/pics/minus.gif" This
image has to be retrieved at least once from the server: and it is
retrieved once the first time the image is displayed or initialize over
Image object. Ever after your browser will take the image from the
cache w/o extra loading from the server.
You don't need to worry about caching, just opposite you need to take
extra steps to *not* cache an image (by say randomizing its URL).
The traditional image precaching:
var iOver = new Image();
iOver.src = 'http://www.myserver.com/pics/foo.gif';
doesn't affect on the cache behavior. It is used to avoid the *initial*
delay when say foo.gif is requested for the first time. After the first
usage (so the image was cached) there is absolutely no difference
whether you precached that image or not: it will be still taken from
the local cache with the same speed. |