lazysizes icon indicating copy to clipboard operation
lazysizes copied to clipboard

supportScroll for headless navigator

Open TunaFFish opened this issue 1 year ago • 0 comments

supportScroll for headless navigator

So I saved a website offline (sitesucker) and trying to convert the webpages to PDF's using the WKHTMLTOPDF library using command lines. I found out with some JS that WKHTMLTO PDF's headless navigator support sscroll events. Navigator: Netscape App version: 5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) Qt/4.8.7 Safari/534.34 App codename: Mozilla Platform: MacIntel Scroll support: true

This of course gives me the problem of images not being loaded...

So I tried hardcoding the supportScroll in the loader function var supportScroll = false; // ('onscroll' in window) && !(/(gle|ing)bot/.test(navigator.userAgent));

This seems to work in Firefox, the images have the classes changed to lazyautosizes and lazyloaded and the low res images are replaced.

Using the WKHTMLTOPDF's the full res images out of the viewport are NOT loaded.

Same using Safari, the images out the viewport are not replaced!

TunaFFish avatar Jan 01 '23 11:01 TunaFFish