I have a couple of questions about the attributes async
& defer
for the tag which to my understanding only work in
HTML5: async
, defer
In HTML5, you can tell browser when to run your JavaScript code. There are 3 possibilities:
Without async
or defer
, browser will run your script immediately, before rendering the elements that's below your script tag.
With async
(asynchronous), browser will continue to load the HTML page and render it while the browser load and execute the script at the same time.
With defer
, browser will run your script when the page finished parsing. (not necessary finishing downloading all image files. This is good.)