How to load javascript files asynchronously in HTML

sam
sam
134 Points
62 Posts

How to load JavaScript files asynchronously in HTML?

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

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1170 Points
210 Posts
Marked as answer      

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
banner

Blog

Active User (2)

 Log In to Chat