Find out if a script was executed asynchronously as soon as it was available:
The result of x will be:
The async property sets or returns whether a script should be executed asynchronously as soon as it is available, or not.
This property reflects the async attribute of the <script> tag.
Note: The async 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 async property is supported in all major browsers.
Note: The async property is not supported in IE 9 and earlier versions, and in Opera 12 and earlier versions.
Return the async property:
Set the async property:
Value | Description |
---|---|
true|false |
Specifies whether a script should be executed asynchronously as soon as
it is available, or not
|
Return Value: | A Boolean, returns true if the script is executed asynchronously as soon as it is available, otherwise it returns false |
---|
HTML reference: HTML <script> async attribute