![]() |
DHTML: IE DHTML/DOM images caching bug
Hi all,
Well, I have some kind of menu, which I'm rendering with innerHTML property inside some divs. Problem is that IE doesn't gets newly created images from cache, it reloads it again, no metter if it is the same image all the time. IE cache options are on "automatic" (but it shouldn't have this problem even if it's on "every visit to the page" as I understand the standard browser behaveour) On Opera and Mozzila there is no problem. It works as it should (images are not loaded again) I found only one similar post but with no solution on http://www.dotnet247.com/247referenc...30/150361.aspx As I see it, it's explorer bug, but i couldn't find documentation or workaround anywhere. Here is an example. You just have to provide some existing image name (test.gif), and test shoul be tried on some live server, because on local machine IE loads images too fast so you can't actualy feel the problem. HTML Code:
Thanks, Tole |
Hi Tole
Welcome to the City!:) The method that you are using is not DOM but just copying a string into the innerHTML. The image is not pre-cached because you are not pre-loading the image. Try this out: HTML Code:
<?xml version="1.0" encoding="UTF-8" ?> |
thanks for quick response
1. dom/dhtml - I'm still mixing it up, but in this case symptoms are the same for both methods. 2. image should be pre-cached because i have img tag with very same picture as src inside html body and it is allready loaded when i press the button 3. no, it still doesn't work :( . in ie status bar still has "n items remaining (downloading picture ....)" when button is clicked. please check it out http://www.nazivdomene.hr.lin4.ims.h..._caching3.html - your (dom) example or http://www.nazivdomene.hr.lin4.ims.h...m_caching.html - mine (dhtml) example btw, i chosed to work with innerHTML because it should be quicker in IE http://msdn.microsoft.com/library/de.../DHTMLperf.asp and it's easier :). |
OK.Hmmm... Something funny going on here.
I thought I'd try it on my local server, so I copied the page to a local file. Then I tried to make a local copy of the image, but IE would only allow me to save the image as "untitled.bmp" (a straight copy & paste wouldn't work either). I know that the "only can save as BMP" problem is sometimes common for IE, but I should point out that this problem doesn't usually occur on my PC (I have just tried some other online gifs, and they save OK). Next I tried your demo, by hotlinking (apologies) to your online image. The "no cache" problem was still in effect. So now I tried hotlinking to an online GIF picked at random from the web. ..There was no problem with that. The image was cached, and I got 500 copies on a webpage in no time. My conclusion is that there is some anomaly in the way that you a serving this image that is inducing IE you convert (?) it to an anonymous (?) BMP image in the cache. Thus, every time the page requests test.gif, it isn't there. Just what kind of server problem this is, I don't know. Mime-type header, perhaps ? |
Yes :), that's it.
thanks a looot. i tried it on my colegues server and it works ok. now i only have to fight with my host admins to fix it (still not sure what settings are envolved). btw here are few links on microsoft pages wich are describing problem from explorer point of view. http://support.microsoft.com/default...b;en-us;810978 http://support.microsoft.com/default...;EN-US;q260650 thanks againt Tole |
Not that I know enough about these complexities to be certain, but I have the feeling that the issue, although in some way related, is different from the usual "save images as BMP" problem (wrt the posted links).
- We already know this, of course, because you have shown it to be server-dependent. Again, I don't have the usual BMP problem on my PC. Also, that problem can always easily be worked around by using copy & paste, or simply drag-dropping the image into an open folder. This workaround doesn't work for this new variation of the disease. |
Quote:
I've just checked that on your test pages. As far as I know, the default is to have this setting at "automatic". :-) There is also a solution involving server headers, that will work even for those users, who have "Every visit to the page" setting... Hope this helps ;-) |
Hello, iku. That wasn't the problem this time. I don't have that cache setting (and didn't at the time). It also fails to explain why the only "Save as" option was BMP only for images from that server only.
|
Roland,
I tried one of the linked-above test pages in IE 6.0. With cache setting "Every visit" I saw images loading slowly, one by one. Then I switched the setting to "Automatic" and saw the images appearing all at once, immediately. |
BTW, there is a suspicious HTTP header with this image coming from that server. Here is a complete listing of the HTTP headers of with which the http://www.nazivdomene.hr.lin4.ims.hr/test/test.gif is served:
Code:
HTTP/1.0 200 OK |
Looks very suspicious. I have no idea what it means though.
|
| All times are GMT +1. The time now is 04:28 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2010, WebXpertz.com. All Rights Reserved.