Internet Explorer innerHTML Quirk

I admit it: when I hit a wall programming I type a few words into Google and click on the first few results. Very rarely have I ever looked at the Microsoft Knowledge Base. But every once in a while someone will forward me an article from there and I’m just left thinking, “damn.”

Case in point, did you know that when you insert img tags into a document using innerHTML that the images are re-requested from the server and not used from the cache? According to this article, this functionality is “by design” in Internet Explorer and won’t be fixed. Well, it’s good to know that this happens but why is that how it should behave? Shouldn’t you always be using cached data whenever possible? What’s even more annoying is that the solutions they give aren’t really practical. Sometimes you don’t know what images will be loaded, so there’s no way to preload them. The second proposed solution, to provide a time delay, doesn’t explain how one would go about creating such functionality. Argh.

Was this helpful? If you found this post helpful, I would very much appreciate your support. Donations of any amount gratefully accepted.