Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML script defer attribute

HTML

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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:


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