|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
background image in ie downloaded every time...
i have a loop where each iteration changes background image of div with this line
divid.style.backgroundImage="url(images/face.png)" the problem is that IE always downloads the image despite that it already was displayed many times earlier.... and as a result the effect is very slow... Is there a way to cashe this image and then use it as background image? (so IE doesn't download it every time it needs to be displayed) thank you |
|
#2
|
|||
|
|||
|
RE: background image in ie downloaded every time...
put this in your images folder on your server
save it as .htaccess Code:
ExpiresActive On ExpiresDefault "access plus 2 months" your server should now send the proper expires headers along w/ the images, and IE should cache them now. |
|
#3
|
|||
|
|||
|
RE: background image in ie downloaded every time...
thanks for replying
for now i know that my apache does send 304 responce so everything is ok on server side.(i see it in logs) (i also tried to send "expires" header with each image but this doesn't help) what i know for now is that it is not the fault of server side but IE's what is really happening is that ie, no matter what ,always tries to download the image despite 304 answer... i also managed to isolate the cause of when ie wants to download the images again...it happens every time something on page needs to be redrawn or shown or moved...IE tries to download ALL affected images and backgrounds. for example i have some simple slide show from two images.first image(pic1.png) appears, secong image(pic2.png) disappears and that repeats itself again. the moment each image appears i see in status bar message "downloading pic1.png..." or "downloading pic2.png" and if this slideshow runs every 100msec then each and every time ie tries to download these images and also all other images that are affected by these two... (by the way the same thing happens in opera) but in firefox everything is fine... this 100% ie rendering issue and i'm not sure whether it is possible to fix it...i posted about this problem on couple of others forums but noone seems to know what to do...for example see here: http://www.webdeveloper.com/forum/showthread.php?postid=282195 |
|
#4
|
|||
|
|||
|
RE: background image in ie downloaded every time...
im pretty familiar w/ this problem
sending the expires headers has always worked for me. have you changed your cache settings in ie? often people who build websites have changed them tools>internet options>general tab>settings if you have it set to "every visit to page", that could be your problem when set to "automatically", the expires headers makes it behave as we want, at least on my system (ie6 both sp1 and sp2, xp pro) i know of a css method that will work regardless, but it involves using a background image and an img tag on top of it. it can only switch between 2 images, but it WILL do it flicker free w/out js if that sounds like it will work for you, ill post a demo. but it sounds like you need to switch between multiple images, you said loop. have you tried preloading the images in js? one time i was able to use css to switch between multpile images using just css, flicker free, but it was very complex, and wasnt very portable(a ton of style rules and markup). it was about a year ago so i dont remember exactly how i did it, but im sure i could reproduce it if it tried. theres also this little gem(not really realted to your problem, but you might find it intresting). its a kinda a bulky download for your users, but as long as its cached after the first request, its absolutely great. makes ie VERY standards compliant http://dean.edwards.name/ie7/ |
|
#5
|
|||
|
|||
|
RE: background image in ie downloaded every time...
see if this works for you
http://rehfeld.us/hover.html you know i even tried it w/out the expires headers and it still worked. maybe the etag header header comes into play here, and makes ie behave or something. i realize a 304 response from your server _SHOULD_ tell ie not to redownload it, period. but, this is ie were talking about after all lol i can even download the page in ie, then delete the file from my server, and keep hovering over the image in the page i downloaded, and it works. this tells me ie is NOT even bothering to contact my server between hovers. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > background image in ie downloaded every time... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|