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.


  1. José Jeria

    I wonder why they dont mention versions prior to 5.5 (5.0 for example that we still support in our company). I wonder if it&#039s because it worked differently there or because they dont support prior versions anymore...

  2. Nicholas C. Zakas

    I&#039d be willing to bet that&#039s probably the case. Microsoft is infamous for cutting off support for older products (witness the hoopla over them ending Visual Basic 6 support).

Understanding JavaScript Promises E-book Cover

Demystify JavaScript promises with the e-book that explains not just concepts, but also real-world uses of promises.

Download the Free E-book!

The community edition of Understanding JavaScript Promises is a free download that arrives in minutes.