Skip to content

add loading=lazy attribute to iframes generated by pym.js#741

Open
bothness wants to merge 1 commit intodevelopfrom
lazy-load-iframes
Open

add loading=lazy attribute to iframes generated by pym.js#741
bothness wants to merge 1 commit intodevelopfrom
lazy-load-iframes

Conversation

@bothness
Copy link
Copy Markdown

What

Changed pym.js code to make iframes have a loading="lazy" attribute. This will significantly reduce server load when users request pages with a load of data viz content in iframes.

How to review

Load a page with a data viz iframe (eg. https://www.ons.gov.uk/economy/inflationandpriceindices/articles/howisinflationaffectingyourhouseholdcosts/2022-03-23) and make sure that the iframe loads correctly and has a loading="lazy" attribute.

Who can review

The change was made by me based on discussions involving @418error

Copy link
Copy Markdown
Contributor

@jondewijones jondewijones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned on slack on 15 Mar 2024

A concern with this approach would be that we're modifying a third party minified library which creates a maintenance problem for us and isn't best practice.

It could be worth more investigation to identify other possible solutions/approaches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants