Description:what is purpose of using async or defer attribute on script tags or files and on css files and what is the difference between async and defer attribute and how to use them to efficiently load my scripts and styles.
Posted by: Umer khan | Posted on: Feb 11, 2019
2
<script src="SomeFile.js" async />
async downloads the file during HTML parsing and will pause the HTML parser to execute it when it has finished downloading.
<script src="SomeFile.js" defer />
defer downloads the file during HTML parsing and will only execute it after the parser has completed. defer scripts are also guaranteed to execute in the order that they appear in the document.
Replied by: Peter Andre | Replied on: Feb 15, 2019