How to load javascript files asynchronously in HTML

sam
sam
Member
378 Points
48 Posts

How to load JavaScript files asynchronously in HTML?

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

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 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