Easy Tutorial
❮ Prop Textarea Type Prop Embed Src ❯

defer Attribute

Script Object

Example

Check if the script executes when the page finishes parsing:

x Output result:


Definition and Usage

The defer attribute sets or returns whether the script should execute when the page finishes parsing.

This attribute reflects the defer attribute of the <script> tag.

Note: The defer attribute is only applicable to external scripts (only when the src attribute is used).

Note: There are several ways to execute external scripts:


Browser Support

All major browsers support the defer attribute.

Note: Opera 12 and earlier versions do not support the defer attribute.


Syntax

Return the defer attribute:

Set the defer attribute:

Attribute Values

Value Description
true/false Specifies whether the script should execute when the page finishes parsing. true - The script executes when the page finishes parsing.<br>false - The script does not execute when the page finishes parsing.

Technical Details

| Return Value: | Boolean, returns true if the script executes when the page finishes parsing, otherwise returns false. | | --- | --- |


Related Articles

HTML Reference: HTML <script> defer Attribute


Script Object

❮ Prop Textarea Type Prop Embed Src ❯