Beginning in December, and recently completing with release 110, Chrome has deployed Memory Saver functionality by default to reduce the amount of RAM that Chrome uses. While this behavior of discarding (unloading) tabs isn’t new, the scenarios under which it can occur have been expanded in the name of performance gains.
Impact to Data Storage
Due to the fact that the page is discarded, data storage mechanics revolving around beforeunload
, pagehide
and unload
may not function properly. Instead, Google recommends storing data as it changes, or with a visibilitychanged
event. Code samples (including testing directions) can be found on their documentation for developers.
Detecting Discarded Tabs
You can test for tabs being reloaded after discard in Chrome via the document.wasDiscarded
property. I would recommending testing for support of the property before use, as currently only Blink based browsers support it. This way you can tell if pages on your site are being reloaded because your users are leaving the tab for your website open in the background, rather than manually reloading it via a browser action.
If you have specialized logic that detects reloads – you may want to review the use case in light of this new behavior.