0

What situation would need you to load javascript first before html and css?

12th Oct 2022, 4:41 AM
Mozzie
Mozzie - avatar
3 Antworten
+ 3
If the script doesn't refer any element in the document then it's okay to load the script before the document contents are loaded. Otherwise, the page may not load properly due to an error that happens when the script or parts of it tries to get an element's reference and fail on its way, because the targeted element wasn't loaded at the time.
12th Oct 2022, 5:59 AM
Ipang
+ 2
Hi! why did you decide that the situation requires the first download of javascript?
12th Oct 2022, 4:57 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Sometimes HTML and CSS are dynamically generated by javascript you only need to run js on your page first and foremost.
12th Oct 2022, 4:58 AM
🆂🅷🅾🆅🅰🅽
🆂🅷🅾🆅🅰🅽 - avatar