HTML
Try it »
Browser support





All major browsers support the defer attribute.
Definition and Usage
The defer attribute is a boolean attribute.
The defer attribute specifies that the script is executed only after the page has finished loading.
**Note:** The defer attribute only applies to external scripts (only when the src attribute is used).
**Note:** There are several ways to execute external scripts:
- If async="async": the script is executed asynchronously with respect to the rest of the page (the script is executed while the page continues to be parsed)
- If async is not used and defer="defer": the script is executed when the page has finished parsing
- If neither async nor defer is used: the script is read and executed immediately, before the browser continues parsing the page
Differences between HTML 4.01 and HTML5
none.
Differences between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the defer attribute must be defined as