defer vs async
🏷️ Javascript, Web dev
defer
- fetch the script parallel as the parser executes
- execute the script after parsing is complete
async
- fetch the script parallel while parsing
- execute asap as it is available
- parsing is blocked while the script executes
https://www.patterns.dev/vanilla/third-party
https://javascript.info/script-async-defer
https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript