I am trying to lazily load javascripts, but I cannot get it to work reliably. My pages load pretty quickly, and I want to save them that way, so I'm not going to use a timeout to delay loading. Besides document.readyState, how can I guarantee that the DOM is really ready for modification?
Method I:
readyState poll
createElement script
src = url
appendElement to head
Results:
IE8: always interrupts
FF3: loads the first time, interrupts each other
Chrome: loads the first time, interrupts each other
Method II: ( lazyload included in the header)
Results:
IE8: always interrupts
FF3: works
Chrome: loads the first time, interrupts each other