|
Blog de Alejandro Avila > Posts > JavaScript: Defer Execution
|
2/18/2010
First introduced by Internet Explorer 4, the defer attribute of the script element is now part of the HTML 4 and XHTML specifications. The defer attribute gives a hint to the browser that the script does not create any content so the browser can optionally defer interpreting the script. This can improve performance by delaying execution of scripts until after the body content is parsed and rendered.
Here's the brief paragraph describing the defer attribute from the HTML 4.01 specification:
When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no "document.write" in javascript) and thus, the user agent can continue parsing and rendering.
<script src="script.js" type="text/javascript" defer="defer"></script>
via: http://www.websiteoptimization.com/speed/tweak/defer/
|
|
|
|
|
|
|