-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Create a Performance audit for avoiding the unload event #10848
Comments
I think this is interesting to consider if we can get detection heuristics on when to recommend Developers should be careful using
That said, in previous years both Chrome and Safari have had bugs where they won't fire Would be good to get @philipwalton's opinion here. |
I actually discussed this idea with @patrickhulce and @brendankenny a few years ago. At the time I was hoping to implement the audit myself, but I never got around to it. Now that Chrome is about to ship bfcache, I think something like this would be super useful. Brendan, do you think you'd have bandwidth to take this on? |
FYI for those who haven't heard of bfcache: https://www.chromestatus.com/feature/5815270035685376 I don't see any indication of when it'll land. |
we also had the ancient #871 for
sure, though @kaycebasques called it :) I'll make it your call Kayce. I guess one question is while this is a good practice in isolation, would it be more helpful to users to have a bfcache-able audit with the requirements rolled up into a single place? |
@kaycebasques - Thanks for implementing this audit. Most of our sites are being flagged now by this audit. In our cases, these unload events are coming from third party scripts (like bot detection / marketing etc). For example, In screenshot attached, we see it coming from PerimeterX (Bot Detection) / Facebook / Dynatrace (RUM) In this case, does it really impact backward/forward cache OR this audit should be more about unload events from first party scripts.. ? Sorry.. I am not very familiar with this but this got my attention when I was going through latest lighthouse audits. |
@rockeynebhwani they may confirm but AFAIK the origin of the script that installed a listener has absolutely no impact on whether the page is eligible for bfcache (and I would be shocked if this were the case). |
Feature request summary
Warn web developers that they should avoid
unload
events and usevisibilitychange
instead.I am willing to work on this. Seems like a relatively easy audit to implement.
What is the motivation or use case for changing this?
https://developers.google.com/web/updates/2018/07/page-lifecycle-api#legacy-lifecycle-apis-to-avoid
How is this beneficial to Lighthouse?
It's an easy-to-detect change that could help improve the reliability and performance of websites.
P.S.
How is this beneficial to Lighthouse?
is a strange phrasing. Seems like it should beHow is this beneficial to the web?
The text was updated successfully, but these errors were encountered: