Browser & Web Performance · Junior · Question 11 of 75
What's the difference between the DOMContentLoaded and load events?
- ✓Correct answer:
DOMContentLoadedfires when the HTML is parsed and deferred scripts ran;loadwaits for images, styles and other resources too - 2
DOMContentLoadedwaits for all images;loadonly waits for HTML - 3
loadfires first, thenDOMContentLoaded
Explanation
Code that needs the DOM can start at DOMContentLoaded; load is later and depends on every subresource.