Web App Image Caching

G

Giggle Girl

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.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.

QUESTIONS

1. Does it make sense to use javascript to do a

var Icon_Minus = new Image
Icon_Minus.src = "picsV/minus.gif"

in the main frameset for each of the icons that change (which is about
50), so I will have all changeable icons cached for quick display on
each page when they change?

2. Can you "flip" images in sub-frames that were cached in a parent?

Thanks,
Ann
 
V

VK

Giggle said:
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.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.[/QUOTE]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,304
Latest member
CalmwellCBDIngredients

Latest Threads

Top