I am currently developing Unit Tests for a Javascript method that detects the readiness of the document. This code is already at framework level, so please avoid mentions of
According to this page at MSDN, there's no onload
event for document
.
You want either window.onload
or document.body.onload
. These are identical in IE: for historical reasons, actually sets
window.onload
, so MS decided to make document.body.onload
an alias of window.onload
.
The problem with this is - as Eric mentioned in the comments - that there doesn't seem to be a way to manually fire window events, which means that there might not be a solution for Eric's problem.