Manually Trigger or Prevent Javascript Lazy Loading in Website from Bookmarklet
        Posted  
        
            by 
                stwhite
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by stwhite
        
        
        
        Published on 2012-07-01T02:54:57Z
        Indexed on 
            2012/07/01
            3:16 UTC
        
        
        Read the original article
        Hit count: 313
        
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: ???
 
© Stack Overflow or respective owner