HTML async Attribute is a boolean attribute which defines that the external script being used will be executed asynchronously once the script is available.
Table of Contents
Syntax of HTML async Attribute
The Syntax of HTML async Attribute is shown below.
<script src="" async>
</script>
Usage of HTML async Attribute
HTML async Attribute is used to specify the asynchronous nature of external script. It means that script will be executed during the page parsing.
It is only used for external scripts.
It is only used when src attribute is defined.
Used For
HTML async Attribute is used for following tags.
Tag Name |
---|
HTML script Tag |
Example of HTML async Attribute
Simple example of HTML async Attribute is given below.
<script src="external-script.js" async>
</script>
In above example we have used HTML async Attribute for external script file named external-script.js.
Values of HTML async Attribute
Following values can be used with HTML async Attribute.
Value | Description |
---|---|
async | Defines that script is asynchronous |
Note: async="async" and only async both are used.
Browser Support for HTML async Attribute
HTML async Attribute is supported by following major browsers.
Browser Name | Version |
---|---|
Chrome | All |
Firefox | 3.6 and above |
Opera | All |
IE / Edge | 10.0 and above |
Safari | All |