How to load javascript files asynchronously in HTML

154 Points
67 Posts

How to load JavaScript files asynchronously in HTML?

Views: 8958
Total Answered: 1
Total Marked As Answer: 1
Posted On: 16-Aug-2015 21:38

Share:   fb twitter linkedin
Rahul Maurya
Rahul M...
1402 Points
236 Posts

Hi Sam,

You can use async Attribute to load javascript file asynchronously.

For example:

<script src="demoasync.js" async></script>

The async attribute is a boolean attribute.
async specifies that the script will be executed asynchronously as soon as it is available.

Note: The async attribute is only for external scripts (and should only be used if the src attribute is present).

Posted On: 22-Aug-2015 23:40
 Log In to Chat