TIL loading="lazy" works on iframes too, not just images
I had a page with several embedded maps and videos that made the initial load crawl. Adding loading="lazy" to the iframes deferred them until they were near the viewport, and the page felt much snappier.
Small thing, but I'd only ever used it on images. Any other one-attribute performance wins you lean on?
Comments · 3
Good one. Native lazy loading is a one-attribute change and works in modern browsers, so you can skip a JavaScript library.
Set a width and height on the iframe or a placeholder so the layout doesn't jump when it loads. Layout shifts are the usual side effect.
Maps and video embeds are often the heaviest parts of landing pages. A quick win with measurable impact on load time.