Manually Trigger or Prevent Javascript Lazy Loading in Website from Bookmarklet
- by stwhite
One of the problems with using a bookmarklet for grabbing images on a page is that if a website uses lazy loading, the bookmarklet won't detect the image because it will have a placeholder, e.g. "grey.gif" and not the actual source of the image. Javascript on page load, is run to replace these urls.
I'm looking for a solution to retrieve those images that are not being displayed by either triggering or preventing Lazy Loading from running. This bookmarklet isn't limited to one specific domain. So far some ideas I've had are:
Ping the domain and retrieve the page html if no images are found the first time around:
Problem: this then requires parsing the actual html.
Problem: with lazy loading, a few images will always show, just none below the fold.
Scroll page to initiate lazy loading when bookmarklet is clicked, then scroll back to top.
Trigger Lazy Loading from inside bookmarklet using script.
Lazy Loader adds the "original" attribute, potentially could check if attribute exists w/ value.
Problem: ???