Hi there,
I have a strange problem in Internet Explorer (IE6 and IE7). I'm writing a JavaScript application which allows the user to edit a photo composition. So when the user selects a photo then a frame is drawn around it with resize and rotate buttons. Now it happened to me that I replaced these buttons (32x32) with larger images (48x48). The filenames were not changed, I only copied the new images over the old ones. Then I reloaded the page and the new buttons were displayed but their positions were not calculated correctly. After some research I found out that Internet Explorer still thinks the new buttons are 32x32 pixels even if it correctly displays the NEW buttons.
I cleared the caches, I restarted the browser, I even restarted Windows but IE still remembers that the buttons are 32x32. The only solution I found so far is renaming my buttons so IE reads the new image sizes...
I made a simple demo for this problem to show you. First of all I made a PHP script which generates and returns a randomly sized image. Be assured that this PHP script is not the problem and even some cache-relevant headers which may be send by PHP are not the problem. The PHP script is only there to simplify the demo. You can use a static image instead if you like and resize it manually before each request.
http://www.ailis.de/~k/permdata/20070910/iebug/
This simple page just loads an image (test.php, which generates randomly sized image) with JavaScript, waits until it is loaded and then prints the image size. Try it in Firefox and you'll get different image sizes on each request. Try it in IE and you always get the first image size. I have not done this in this demo but in my real application I could see that the NEW image is definitely loaded. Only the image size is wrong. So it's not a standard image cache problem where IE does not reload the image. The image IS reloaded but the image size is always used from the first loaded image with the same URL. I did not found a way to tell IE to "forget" this image size. If you know one, please help!
Also interesting is the fact that it works if the image is also loaded via HTML. The image size is only cached if the image is ONLY loaded via JavaScript. See this example where I also include the image with a standard HTML image tag. Suddenly the JavaScript code works:
http://www.ailis.de/~k/permdata/2007...bug/works.html
All this sounds very strange and is annoying as hell. Sure, I could add a random query string to the URL of the button images but then all browsers would no longer cache the button images at all. Up to now I only see the solution to preload the button images with standard HTML code (Using hidden img tags on the page). If you know a better solution then please help.