WebPageTest Homepage WebPageTest, by Catchpoint Documentation

Lazy Loaded Images in Viewport

Return an object containing the sources of all images that have loading=lazy applied, but are within the initial viewport.

[lazy-in-viewport]
let images = document.querySelectorAll('img[loading=lazy]');
let lazyImages = [];
images.forEach( img => {
if (img.getBoundingClientRect().top < window.innerHeight) {
lazyImages.push(img.src);
}
});
return JSON.stringify(lazyImages);