The following test verifies whether or not the browser executes code before the
window.onload is called and after the DOM content has been loaded entirely—the event known as
This test was created because Dean Edward's revisited solution for MSIE (via Matthias Miller) sporadically failed to be called before
onload when the document didn't have any external images to load;
however, Dean's original solutions did not fail—the
DOMContentLoaded-substitute handler code was called beforehand
onload as desired. I discovered these issues in the development of a cross-browser Web Forms 2.0 Repetition Model implementation.
My testing has led me to conclude that original solutions which rely on either an external HTC file or a JS file loaded with
script[defer] are necessary when code must be executed before
onload while also after the DOM tree has been completely built.
View this page in Internet Explorer 7 to observe the issue which I have described.
Test result: loading document... (no code has been executed)