[thelist] Rollover that changes to an animation that loops only once

Warden, Matt mwarden at odyssey-design.com
Sat Apr 28 11:01:32 CDT 2001


> I designed a rollover that image changes to an animation that loops
> only once. In IE 5 Mac, It plays correctly once, then subsequent
> times you mouseover, the last image (the animation completely loaded)
> of the animation plays before the animation sequence. This seems like
> the image is cached, but even an option - reload won't play it
> properly again, only quitting the browser and relaunching will again
> play it only once correctly.
...
> It does not happen in NN6, NN 4.76, or iCab. It doesn't make a
> difference if I have IE cache set at 0. I'm suspecting there's no way
> around this and it's a quirk of IE 5.

Well, one thing you can do is append a querystring to the image's src that
needs to be uncached if the browser is IE5. So, you WOULD preload all
images, but at the time of a image swap (psuedo-code):

if browser = IE5 then
    [reload the src attribute of that image object]
    myimg.src = "myimg.gif?" + getRandomQuerystring();
end if
[do swaps]
...
function getRandomQuerystring()
    return (round((getRandomNumber()*100)) + "" + getTimeInMilliseconds());
end function

(where getRandomNumber() is a built-in "random" number generator of the
language and getTimeInMilliseconds() is a built-in function that returns the
current time in milliseconds)

you'll end up with a image src of something like "myimg.gif?7410298377423",
and that'll change every time the image is swapped. So, since the filename
changes, there shouldn't be any caching issues.

hth your caching problem



--
mattwarden
mattwarden.com





More information about the thelist mailing list