Find out if a script was executed when a page was finished parsing:
The result of x will be:
The defer property sets or returns whether a script should be executed when a page has finished parsing, or not.
This property reflects the defer attribute of the <script> tag.
Note: The defer attribute is only for external scripts (and should only be used if the src attribute is present).
Note: There are several ways an external script can be executed:
The defer property is supported in all major browsers.
Note: The defer attribute is not supported in Opera 12 and earlier versions.
Return the defer property:
Set the defer property:
Value | Description |
---|---|
true|false |
Specifies whether a script should be executed when the page has finished
parsing, or not
|
Return Value: | A Boolean, returns true if the script is executed when the page has finished parsing, otherwise it returns false |
---|
HTML reference: HTML <script> defer attribute