HTML5 > Structures

Async in HTML5

How to use the Async attribute in HTML5?

Async attribute is the Boolean attribute. Async means the script downloads asynchronously while the pages continue to parse.

    <script src="asyncMyJavaScript.js" async onload="GreetUser()"></script>

    <h1>Hello hello hello, this is async attribute of script element.</h1>
    async - The script downloads asynchrnously while the page continue to parse.

    The script is executed when the page is finished parsing.

    <button onclick="SometOtherFunction()">Click me to test.</button>

When the page finishes loading, GreetUser() function is called.


 Views: 707 | Post Order: 80

Write for us