← Back to release summary

Disconnect WebSockets on BFCache entry

Category
Miscellaneous
Type
No developer-visible change
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Chrome is changing its behavior to allow pages with active WebSocket connections to enter the Back/Forward Cache. To achieve this, active WebSockets are now disconnected when a page is cached. Previously, active WebSocket connections prevented pages from entering BFCache. To revert to the previous behavior (preventing pages with active WebSockets from entering BFCache), we've provided a [BackForwardCacheForWebSocketsAllowed](https://chromeenterprise.google/policies/#BackForwardCacheForWebSocketsAllowed) policy. Admins can set this policy to _Disabled_ , which will prevent breakage in legacy apps that lack WebSocket reconnection logic. For more information on BFCache, see [Test back/forward cache](https://developer.chrome.com/docs/devtools/application/back-forward-cache).

Motivation

Currently, any active WebSocket connection forces the browser to discard the page when the user navigates away, preventing it from being stored in the Back/Forward Cache (BFCache). We are changing this behavior to allow these pages to be cached by closing any active WebSocket connections upon entry. This approach mirrors the behavior for WebTransport. For web developers, this change is designed to be compatible with existing patterns. When a page is restored from BFCache, the browser fires the error and close events, enabling applications to simply trigger their existing reconnection logic to pick up where they left off.

Standards & signals

View on chromestatus.com