Connecting Tech Pros Worldwide Help | Site Map

setting the src attribute using script and caching images

cosmic foo
Guest
 
Posts: n/a
#1: Jul 27 '05
I have noticed that when you set the src attribute of an img via script,
(instead of hard-coding in the img tag), although it caches the images,
if you leave the site and return, the browser has to re-cache the images.
Is that just the way it is, or is there a way to not lose the cache?
Thanks.


ASM
Guest
 
Posts: n/a
#2: Jul 27 '05

re: setting the src attribute using script and caching images


cosmic foo wrote:[color=blue]
> I have noticed that when you set the src attribute of an img via script,
> (instead of hard-coding in the img tag), although it caches the images,
> if you leave the site and return, the browser has to re-cache the images.[/color]

no, I don't think it does re and re and re-cache same image ou same src
onload it always verify if image (even an image.src) is in its cache
just by scripting you realy ensure it does it and get a local source
then you can re-use src instead of url
-> shorter code and image from cache without mistake
(no need to call server (send requests existing img? date? and so one) )

--
Stephane Moriaux et son [moins] vieux Mac
cosmic foo
Guest
 
Posts: n/a
#3: Jul 27 '05

re: setting the src attribute using script and caching images



"ASM" <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> wrote in message
news:42e7938f$0$1216$8fcfb975@news.wanadoo.fr...[color=blue]
> cosmic foo wrote:[color=green]
> > I have noticed that when you set the src attribute of an img via script,
> > (instead of hard-coding in the img tag), although it caches the images,
> > if you leave the site and return, the browser has to re-cache the[/color][/color]
images.[color=blue]
>
> no, I don't think it does re and re and re-cache same image ou same src
> onload it always verify if image (even an image.src) is in its cache
> just by scripting you realy ensure it does it and get a local source
> then you can re-use src instead of url
> -> shorter code and image from cache without mistake
> (no need to call server (send requests existing img? date? and so one) )
>
> --
> Stephane Moriaux et son [moins] vieux Mac[/color]

what?


Closed Thread


Similar JavaScript / Ajax / DHTML bytes