[wp-trac] [WordPress Trac] #58773: Improve oEmbed lazy loading
WordPress Trac
noreply at wordpress.org
Wed Nov 22 19:58:35 UTC 2023
#58773: Improve oEmbed lazy loading
-----------------------------+------------------------------------------
Reporter: adamsilverstein | Owner: adamsilverstein
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.5
Component: Embeds | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: performance, sustainability
-----------------------------+------------------------------------------
Comment (by adamsilverstein):
I started working on this as an experimental modules for the Performance
Lab plugin in https://github.com/WordPress/performance/pull/886
This module attempts to optimize oEmbeds using two techniques:
- For oEmbeds delivered as iframes, ensure the loading=lazy attribute is
present
- For oEmbeds built using script tags:
- move the script src to a data attribute
- add a page level IntersectionObserver that sets script src before the
user scrolls to the oEmbed (using a 500px margin)
The impact of the change would of course depend of which and how many
oEmbeds a site used, however I think this is worth exploring a bit further
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58773#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list