Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight third parties with unload event handlers? #185

Open
KenjiBaheux opened this issue May 27, 2022 · 3 comments
Open

Highlight third parties with unload event handlers? #185

KenjiBaheux opened this issue May 27, 2022 · 3 comments

Comments

@KenjiBaheux
Copy link

Would it be possible to highlight third parties that still rely on unload event handlers?

Those break the back/forward cache on some browsers, and are unreliable on other browsers or mobile platforms.
There are better alternatives available which don't have these downsides (e.g. visibilitychange).
More details in this lighthouse issue.

We did a large outreach to increase awareness and successfully convince lots of third parties to migrate away from unload event handlers, but there is still a long tail of third parties... Perhaps, thirdpartyweb could help raise awareness at scale?

Here is a query that should give a list of unload event handler sources:

SELECT COUNT(*) AS CNT, unload_source, unload_line, unload_column 
FROM `httparchive-lighthouse.BestPractices.unload_sources`
GROUP BY unload_source, unload_line, unload_column 
ORDER BY CNT DESC LIMIT 1000;
@patrickhulce
Copy link
Owner

Thanks for filing @KenjiBaheux :)

Always happy to consider additional perf impact of 3Ps! While we're shifting from 1->n metrics, network bytes is another stat we've been wanting to surface for a while too.

Getting the data should be the easy part, new visualizations / presentation / exploration is the harder part. If you have any idea in mind for the best way to structure this more complex perf story of 3Ps, it'd be much appreciated! 3x metrics across every 3P probably isn't scaling well in the markdown file anymore 😅

@KenjiBaheux
Copy link
Author

From a perf angle:

  • it only takes one unload handler to block the BFCache from doing its thing. So, the performance cost goes far beyond the cost of a particular 3P.
  • It's essentially triggering a normal page load (albeit warm) instead of a near-instant restoration from the BFCache (a copy in memory).
  • On Chrome, this could negatively impact up to 1 in 5 (Android) or 1 in 10 (desktop platforms) navigations (source).
  • I wonder if there is data available to characterize the missed opportunity (e.g. representative CWV values for back/forward navigations for a given site or overall)?

@patrickhulce
Copy link
Owner

patrickhulce commented May 31, 2022

Thanks for those additional data points! Apologies for the miscommunication @KenjiBaheux I'm already super clear on the perf impact, only the UI/UX/presentation of this data is a blocker from my perspective. I'll need to find time to think about it (and anyone else is very welcome to jump in here! 🎉 )

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

No branches or pull requests

2 participants