HTML script async attribute
Examples
Once the script is available, it will run asynchronously:
<script src="demo_async.js" async></script>
try it"
Browser Support
Internet Explorer 10, Firefox, Opera, Chrome and Safari support async attribute.
Note: 9 and earlier versions of Internet Explorer do not support async attribute <script> tag.
Definition and Usage
async attribute is a Boolean attribute.
async attribute Once the script is available, the asynchronous execution.
Note: async property applies only to external script (only when using the src attribute).
Note: There are several ways to perform an external script:
- If async = "async": script asynchronously with respect to the rest of the page execution (when the page continues to be parsed, the script will be executed)
- When the script execution will be completed parsing the page: If you do not use the async and defer = "defer"
- If neither use nor async defer: Before the browser to continue parsing the page, immediately read and execute scripts
Differences between HTML 4.01 and HTML5
async attribute is new in HTML5 attributes.
Differences between HTML and XHTML
In XHTML, prohibit attribute minimization, async property must be defined as <script async = "async">.
grammar
<script async>
HTML <script> tag