HTML & CSS · Senior · Question 47 of 75
A gallery with 50 YouTube videos loads very slowly. What should you do first?
- 1Embed all
<iframe>s withautoplay=0so videos don't start - ✓Correct answer: Show preview images and insert the
<iframe>only on click - 3Preload all videos in advance with
<link rel="preload">
Explanation
Each YouTube iframe pulls hundreds of kilobytes of JS and many requests. The facade pattern (e.g. lite-youtube-embed) shows a static thumbnail and swaps in the player only on interaction. loading="lazy" on iframes also helps. autoplay=0 doesn't reduce the embed's weight.