Scripts: async & defer with DOMContentLoaded | JS , HTML
Vložit
- čas přidán 5. 09. 2024
- Notes :
DOMContentLoaded
- it is triggered when all content is loaded ( before rendering with some excpetion)
Normal Case
- line by line execution
- for script tag DOMContentLoaded will not wait
async and defer = async load
async Case
- script tag loads independetly and executes independetly
- DOMContentLoaded and async scripts don’t wait for each other:
defer case
- script tag loads independetly and executes when the DOM is ready
- DOMContentLoaded event handler waits for the deferred script. It only triggers when the script is downloaded and executed.
#coding #javascript #async #defer #javascript
#html #script #DOM #AkshaySaini
@AkshaySaini
Please follow us
/ dev.19.community
Thanks for watching us ...
Dev19🖤
really helpful . but take care of yourself and treat you cough
Thanks 😊