Connecting Tech Pros Worldwide Help | Site Map

Web App Image Caching

  #1  
Old February 9th, 2006, 02:45 PM
Giggle Girl
Guest
 
Posts: n/a
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.

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

  #2  
Old February 9th, 2006, 03:35 PM
VK
Guest
 
Posts: n/a

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.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
In ASP.NET can I cache a <body>'s background image? =?Utf-8?B?TWlrZQ==?= answers 4 November 29th, 2007 06:35 AM
Prevent client image caching =?Utf-8?B?SmVmZiBCZWVt?= answers 9 May 8th, 2007 06:25 PM
Image Control not refreshing Mark Denardo answers 6 October 22nd, 2006 01:05 AM
Rebinding page after image is resized on server not showing new sized image Earl Teigrob answers 2 November 18th, 2005 05:28 AM