scholia
scholia copied to clipboard
Add lazy loading for iframe content in sparqlToIframe function
Fixes #1652 Pr which seems lazy loading not working and causing memory problems.
Description
Enhances the sparqlToIframe
function by implementing lazy loading for iframe
content. The function now utilizes Intersection Observer to defer the loading of iframe content until it enters the viewport, improving page load performance by only loading content when it becomes visible to the user. The URL for the iframe content is stored in a data-src attribute, and the src attribute is set dynamically when the iframe enters the viewport.
Caveats
No caveats.
Testing
Tested some of #615 with google lighthouse and saw performance improvements and better memory usage.
Checklist
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I have not used code from external sources without attribution
- [x] I have considered accessibility in my implementation
- [x] There are no remaining debug statements (print, console.log, ...)