Javascript Reference
Categories: Obj_Document

javascript Obj_Document readyState

@March 15, 2008, 1:22 a.m.
readyStateFirefox/Netscape/NN n/a IE 4 Chrome/Safari/DOM n/a  

Read-only  

Returns the current download status of the object's content. If a script (especially one initiated by a user event) can perform some actions while the document is still loading, but must avoid other actions until the entire page has loaded, this property provides intermediate information about the loading process. You should use its value in condition tests. The value of this property changes during loading as the loading state changes. Each change of the property value fires an onReadyStateChange event (the event does not bubble).

 

When introduced with IE 4, the property was available for only the document, embed, img, link, object, script, and style objects. IE 5 expanded coverage to all HTML element objects.

 
Example
 
if (document.readyState == "loading") {
		    //statements for alternate handling while loading
		}
 
Value

For all but the object element, one of the following values (as strings): uninitialized | loading | loaded | interactive | complete. Some elements may allow the user to interact with partial content, in which case the property may return interactive until all loading has completed. Not all element types return all values in sequence during the loading process. The object element returns numeric values for these five states. They range from 0 (uninitialized) to 4 (complete).

 
Default

None.


Powered by Linode.