SCRIPT.defer (Property)

Whether the execution of a script object is to be deferred during page loading to speed the construction of a page.


DOM level - 1
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Property/method value type:Boolean primitive
JavaScript syntax:-mySCRIPT.defer

Deferring script execution can sometimes get round some tricky problems with accessing a page before it is ready. There are certain stages that the page object model undergoes which are not apparent from the outside.

For example, when loading a page a complex object hierarchy needs to be built. That is not going to be complete until the closing </BODY> tag is encountered. Before that time, certain objects may be accessed but others may not. For instance, prior to the body closure, you cannot use a document.write() to insert an ActiveX <OBJECT> tag using inline coding techniques. You can do a <DIV> block replacement when the body has closed but an error results if you try to do this too soon.


See also:XML.defer