Easy Tutorial
❮ Av Event Suspend Att Table Rules ❯

HTML <script> defer Attribute

HTML <script> Tag

Example

The script runs only after the page has fully loaded:


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 when the page has finished parsing.

Note: The defer attribute is only for external scripts (should only be used if the src attribute is present).

Note: There are several ways to execute external scripts:


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 <script defer="defer">.


Syntax


❮ Av Event Suspend Att Table Rules ❯