Modern browsers 'pre-parse' html to find all external resources and they start downloading them immediately (although with different priorities). So classic scripts don't block downloading other resources that are further in the HTML (only parsing is blocked).
There isn't much difference between deferred scripts and scripts placed before </body> tag - they're both evaluated just before DOMContentLoaded event but deferred scripts can be seen sooner (when they are placed in the <head>) and therefore start downloading a bit earlier.
Scripts with type=module (script modules) are deferred by default (but they can be async if needed).
Hey, I wasn't aware of the 'pre-parse' technique of browsers. Yeah, there's not that much difference in placing script before </body> tag and differed script. We can still use our old school method without any guilt. Thanks for the clarification buddy.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Modern browsers 'pre-parse' html to find all external resources and they start downloading them immediately (although with different priorities). So classic scripts don't block downloading other resources that are further in the HTML (only parsing is blocked).
There isn't much difference between
deferredscripts and scripts placed before</body>tag - they're both evaluated just beforeDOMContentLoadedevent butdeferredscripts can be seen sooner (when they are placed in the<head>) and therefore start downloading a bit earlier.Scripts with
type=module(script modules) are deferred by default (but they can beasyncif needed).Hey, I wasn't aware of the 'pre-parse' technique of browsers. Yeah, there's not that much difference in placing script before
</body>tag and differed script. We can still use our old school method without any guilt. Thanks for the clarification buddy.