Alternative DOMContentLoaded for IE

Interesting new JavaScript trick from Hedger Wang: poll the doScroll() method of an unattached DOM element until it stops throwing errors, and when it does, the DOM’s loaded. This gives you the equivalent of the DOMContentLoaded event for IE, and in a rather nicer way than the current-best method of document.write-ing a script tag with a defer attribute. I like this a lot, although I’d like to see some more detail about whether it works in all IEs before switching to it!

2 Responses to “Alternative DOMContentLoaded for IE”

  1. Is his name really Hedger Wang? Wow….

    mrben
  2. Somebody call me when web programming is a little less insane :)

    Travis Reitter

Leave a Reply