I have a couple of questions about the attributes async
& defer
for the tag which to my understanding only work in
async
and defer
will download the file during HTML parsing. Both will not interrupt the parser.
The script with async
attribute will be executed once it is downloaded. While the script with defer
attribute will be executed after completing the DOM parsing.
The scripts loaded with async
does n't guarantee any order. While the scripts loaded with defer
attribute maintains the order in which they appear on the DOM.
Use when the script does not rely on anything.
when the script depends use .
Best solution would be add the at the bottom of the body.There will be no issue with blocking or rendering.