[Gllug] Internet Exploiter caching bug
Simon Perry
gllug at si-designs.co.uk
Mon Apr 5 22:10:14 UTC 2004
Richard Jones wrote:
>Does anyone know what voodoo I have to do to stop IE re-requesting
>images which are (should) already be in its cache? I have some
>buttons on a webpage which use CSS to set the background-image on
>hover. I'm sending Expires headers on the image, with a suitably long
>expiry time. Not surprisingly, while every other browser does the
>Right Thing, Internet Exploder tries to refetch the image each time
>(although I can't reproduce this from my local Windozey machine).
>
>Ideas?
>
>Rich.
>
>81.152.218.8 - - [05/Apr/2004:19:45:07 +0100] "GET /graphics/stars.gif HTTP/1.1" 200 5608 "http://j-london.com/topic/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)" 81.152.218.8.208701081190555802
>81.152.218.8 - - [05/Apr/2004:19:45:07 +0100] "GET /graphics/stars.gif HTTP/1.1" 200 5608 "http://j-london.com/topic/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)" 81.152.218.8.208701081190555802
>
>
Rich,
This is a known bug where IE always request a new copy of an image if it
is defined in a css :hover declaration as it is in div.sitemenu ul li
a:hover in your style sheet. IIRC you can force IE to use a cached copy
by hard coding the image into the body of the page and hiding it with
display:none. Not a particularly semantic solution but may be worth
while as any dial up users with IE will experience very slow rollovers
and even those with faster connections may experience image flicker.
Another approach is to use Pixy's fast rollover technique [0] where you
simply use a single backround image and change the position on rollover,
voilla no caching problems. Another interesting article inspired by Pixy
is "CSS Sprites" on A List Apart [1].
Simon
[0] http://www.pixy.cz/blogg/clanky/cssnopreloadrollovers/
[1] http://www.alistapart.com/articles/sprites/
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list