The browser already knows every image it has loaded, but an extension cannot ask it for that list. chrome.webRequest only shows requests while you listen, and it never sees an image that has not loaded yet: the lazy one 3,000 px below the fold, the one still sitting in data-src , the one a script will copy into place on scroll. So my extension, PixLasso, does it the hard way. It injects one content script into every frame and walks the DOM.
Below: what the walk looks at besides <img> , what it costs on a page with a third of a million elements, and how one off-screen iframe made every scan wait 8 seconds.
One script, every frame, the last expression is the result
The scan is a single file run with chrome.scripting.executeScript . It is an IIFE, and the value of the last expression comes back to the service worker, one result per frame:
const results = await chrome . scripting .…