200+ image loading even with lazyload due to Preload

QuestionsCategory: PDF Light Viewer200+ image loading even with lazyload due to Preload
AvatarShahriyar asked 3 months ago

Hello,
I noted that even with lazy load enabled, there are 100s of image loading on “page load” due to preload feature coded into the plugin JS.
Its basically loading ALL page images at once.
For example you can see it in your demo,
=> https://pdf-light-viewer.wp.teamlead.pw/pro-demo/#page/5
=> https://www.screencast.com/t/KopHPmkQeAb
So, for  a book with 250 images, its executing 250 image calls which is slowing the page
load to over 60s+ for example. (tested on my site in latest Google Chrome)
I fixed the issue by disabling preload in “magazine.js”
commented out this line => //self.preloadImages(magazine);
Now it only loads 3 pages and rest loads on lazy load as user browses the pages. The “webpage” loads pretty fast,
difference is night and day. Just wanted to let you know my findings, might help in future development.
It would be a good to have a admin feature to preload  say 10 pages on page load, then load rest on lazy load OR preload a few pages every min or so.
Just an idea from top of my head, since load speed / page performance is getting more and more important.
 
Great plugin for book and doc viewing. Thank you.
Sincerely,
//Shahriyar

1 Answers
Avatarsuper answered 3 months ago

Hello Shahriyar,
Thank you, that’s was helpful!
For version 1.4.1 we will add setting “Disable images pre-loading”.