- Where Developers Learn, Share, & Build Careers
HTML 5 can be locked in HTMLMax, introduced the
defer attribute for scripts
defer can be used for any script that does not need to be loaded before DOM (aka is not ready before mess with DOM). For a long time, Web developers have been advised that all scripts do not need to be loaded before the dot, instead of in the page head and defer at the end of the body tag and long practice advice? What is the latter option? I appreciate any answers. Thank you.
Both async and defer script start downloading immediately without parsing the parser and both
, so this behavior is not the same in all browsers. Therefore, performance will be better if the script is still at the end, because later it will be downloaded.
Edit 2017: Browser support is better now, so you can probably take part in ASCIN / DEFER scripts in the head. It is still a safe option to possibly put them on the bottom; New browsers will still download them fast, even if they are not in the head.
Comments
Post a Comment