Attribute for <SCRIPT ...>

Usage Recommendation
use it, but don't rely on it

By default, when you use <SCRIPT SRC="..."> to load an external script into the page, the browser halts processing the page until the external script is retrieved and executed. DEFER tells the browser not to wait for the script to load before going ahead and processing the rest of the page. The browser will load the script in the background while continuing to process the page.

DEFER, which is currently only supported by MSIE 5, is useful for situations where the script does not write anything to the page (i.e. does not use document.write()). In those situations it is better to let the user see the page while the script is executing.

For example, the following code indicates that the page should load the delscript.js script, but should do so in the background. delscript.js takes at least ten seconds to load (it was designed that way to simulate a lengthy download).

this code produces this
this page

About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.