Script Tag – async & defer
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
HTML5:
async
,defer
In HTML5, you can tell browser when to run your JavaScript code. There are 3 possibilities:
async
ordefer
, browser will run your script immediately, before rendering the elements that’s below your script tag.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.defer
, browser will run your script when the page finished parsing. (not necessary finishing downloading all image files. This is good.)