Javascript Reference
Categories: SCRIPT

javascript SCRIPT readyState

@July 9, 2008, 4:06 p.m.
readyState Firefox/Netscape/NN n/a IE 4 Chrome/Safari/DOM n/a  



Returns the current download status of the SCRIPT 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.

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

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).



Powered by Linode.