2010/08/12

Interesting Problem: an image that's broken in Internet Explorer but works in every other browser

Earlier today, a friend contacted me with an interesting problem. He was working on a website that strangely enough had an image on it that was not visible in Internet Explorer but was visible in pretty much every other browser (Chrome, Firefox).

My first instinct was to blame this on a caching problem. Maybe he had visited the website in Chrome and Firefox earlier, and maybe they had cached it. He assured me this wasn't the case since clearing out all cached data didn't change a thing.

That was the point where I couldn't say anything more without looking at the page. I did and suddenly it became clear. The first part of the "problem" was that the page in question wasn't handwritten HTML, but was generated by Microsoft Excel. The HMTL code Excel generated for the image consisted of two distinct parts, some VML (Vector Markup Language) and a fallback to gif. Internet Explorer would try to read the VML file and pretty much every other browser would show the gif file. In itself this wouldn't be a problem since the emz file containing the compressed image data was present on the server. Which brings me to the second part of the problem.

This friend of mine wrote his own FTP program. Really. Even after I told him it was a bad idea (well, writing it isn't a bad idea but using it sure is). He uploaded the project folder using his own FTP program. His program tried to upload the emz file (filled with binary compressed data) as a text file, which obviously broke it (replacing \r\n with \n is not a good idea when processing binary files).

All of this results in Internet Explorer attempting to display the broken emz file (and failing) while every other browser ignores the emz file and correctly displays the gif file. I would not have guessed that without looking at the code...

No comments:

Post a Comment