KnugiHK / WhatsApp-Chat-Exporter

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14, Crypt15, and new schema supported.
https://wts.knugi.dev/
MIT License
516 stars 76 forks source link

[FEATURE] Better loading of media #103

Open KnugiHK opened 4 days ago

KnugiHK commented 4 days ago

Discussed in https://github.com/KnugiHK/WhatsApp-Chat-Exporter/issues/90

@jonx suggested:

I'm not a web developer but I did some quick research and maybe all we need to get the lazy loading is add a tag to the images as documented here: https://www.w3schools.com/tags/att_img_loading.asp Only Safari doesn't handle this tag.

<img src="Media/Profile\33610007857-1665000879.thumb" loading="lazy" class="avatar">

Also while commenting on things that I don't really know, maybe you could consider using the base tag in your HTML? Maybe you have a reason not to use it or maybe it's just me but my links are pretty long like this: <a href="AppDomainGroup-group.net.whatsapp.WhatsApp.shared/Media/Profile\6590002603-1700006881.thumb"><img src="AppDomainGroup-group.net.whatsapp.WhatsApp.shared/Media/Profile\6590002603-1700006881.thumb" onerror="this.style.display='none'" class="avatar"></a> with the base tag like this: <base href="AppDomainGroup-group.net.whatsapp.WhatsApp.shared/"> you should be able to shorten the URLs to this: <img src="Media/Profile\33610007857-1665000879.thumb">

KnugiHK commented 4 days ago

@jonx Thanks for your suggestions! The improvement has been made to the dev branch and will be release later.