readyState property
Retrieves a value that indicates the current state of the object.
Syntax
HRESULT value = object.get_readyState(* p);
Property values
Type: BSTR
uninitialized
Object is not initialized with data.
loading
Object is loading its data.
loaded
Object has finished loading its data.
interactive
User can interact with the object even though it is not fully loaded.
complete
Object is completely initialized.
Remarks
Note For the script element, IHTMLDocument2::readyState is no longer supported. Starting with Internet Explorer 11, use HTMLFrameSiteEvents::onload. For info, see Compatibility changes.
An object's state is initially set to uninitialized, and then to loading. When data loading is complete, the state of the link object passes through the loaded and interactive states to reach the complete state.
The states through which an object passes are determined by that object; an object can skip certain states (for example, interactive) if the state does not apply to that object.
Data source objects and databound elements are normally populated asynchronously, and certain programmatic operations can only be performed reliably on databound objects when they are ready for use. Therefore, the appropriate code should be written to confirm the IHTMLDocument2::readyState of objects prior to performing certain operations on them. For example, walking the rows of a table should not be attempted until after the table has reached the complete state.
The IHTMLDocument2::readyState property enables the status of an object to be tested. The correct place to test the IHTMLDocument2::readyState property is in the event handler for HTMLFrameSiteEvents::onreadystatechange. Similarly, a data source object (DSO) fires the HTMLFrameSiteEvents::ondatasetcomplete event to notify the document that the dataset is ready for programmatic operation.