Sometimes, you can design scripts to execute while the document is downloading. In-line scripts for example. At that time, you may even be able to trigger interval timed deferred executions as well.
If it is important that the document has completed loading, you can check this property for one of the following values:
|uninitialized||The object is first instantiated but has not begun loading.|
|loading||The object has commenced loading.|
|loaded||The object has completed loading.|
|interactive||The object is loaded but not yet closed but is ready to handle interaction.|
|complete||The object body has been closed and the loading is finished.|
An object may not need to reflect the complete status before you can commence operating on it. Other objects may require that they are completely loaded. For example, you cannot create an OBJECT object that represents an <OBJECT> tag until the <BODY> has completed loading. This is because the ActiveX object construction requires a complete document body structure to attach itself to.
Every time this readyState value changes, it triggers an onReadyStateChange event call-back.