If you use unload handlers, then you should check out this potential change in Chrome.

Unload handlers are VERY unreliable but on desktop they also prevent the use of the bfcache on Chrome (and Firefox), while on mobile they don't. We want to align it to how it works on mobile.

https://groups.google.com/a/chromium.org/g/blink-dev/c/oU1yt5cdGH8

[Call for feedback] Proposal to gradually skip unload events: already unreliable, top back/forward cache blocker, better alternatives available!

The bfcache allows for instant page navigations when going back or forwards and is one of our key recommendations to help you pass Core Web Vitals:

https://web.dev/top-cwv-2023/#ensure-pages-are-eligible-for-bfcache

So, aligning this to the mobile implementation will improve web performance for desktop.

Our top Core Web Vitals recommendations for 2023

A collection of best practices for optimizing websites' Core Web Vitals performance based on the state of the web in 2023.

web.dev
The Chrome team have worked hard on reducing the use of this notoriously unreliable API across the ecosystem to allow better use of the bfcache, but it is still registered by many sites and page loads, despite often not firing (particularly on mobile): https://chromestatus.com/metrics/feature/timeline/popularity/202
Chrome Platform Status

The `pagehide` event is basically the same as the `unload` event except it does NOT restrict use of the bfcache.

It's also unreliable, but at least doesn't prevent the bfcache being used.

The proposed change will basically make `unload` act pretty much like `pagehide`.

We've long advised using the `pagehide` event (when the page is navigated away) and `visibilitychange` (when a page is backgrounded) over `unload`:
https://web.dev/bfcache/#never-use-the-unload-event

Many sites and libraries have moved to using those, but we're reaching a long tail of code that hasn't.

Back/forward cache

Learn how to optimize your pages for instant loads when using the browser's back and forward buttons.

web.dev

Longer term, the Pending Beacon API hopes to add a RELIABLE way of sending a beacon as the page is discarded, rather than depending on unreliable APIs or visibility changes as a proxy for that.

https://github.com/WICG/pending-beacon#pending-beacon-api

GitHub - WICG/pending-beacon: A better beaconing API

A better beaconing API. Contribute to WICG/pending-beacon development by creating an account on GitHub.

GitHub
The Pending Beacon API (formally called the Page Unload Beacon) is currently in Origin Trail, and we'd love feedback on that too!: https://developer.chrome.com/origintrials/#/view_trial/1581889369113886721
Origin Trials

Chrome origin trials allow developers to safely experiment with web platform features

But, back to the `unload` handler proposed change. Do let us know if you see any problems with this proposal, or have any other feedback:
https://groups.google.com/a/chromium.org/g/blink-dev/c/oU1yt5cdGH8

Let me know if you have any questions!

[Call for feedback] Proposal to gradually skip unload events: already unreliable, top back/forward cache blocker, better alternatives available!