Scripts: async & defer with DOMContentLoaded | JS , HTML

preview_player
Показать описание
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

Thanks for watching us ...
Dev19🖤
Рекомендации по теме
Комментарии
Автор

really helpful . but take care of yourself and treat you cough

poojachauhan
visit shbcf.ru