scholia icon indicating copy to clipboard operation
scholia copied to clipboard

Add lazy loading for iframe content in sparqlToIframe function

Open faresh9 opened this issue 1 year ago • 0 comments

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, ...)

faresh9 avatar Feb 15 '24 18:02 faresh9