Hello there,
Like in the title, I created a simple example of how we can test that issue.
Here we have an example when open connection on pageshow event and then close it on pagehide event:
https://bf-cache-websocket.glitch.me/websocket.htmlHow to test step by step:
- Load page and open DevTools -> Application -> Back/forward cache,
- Click "Test back/forward cache",
- You receive site from bfcache with success,
-
Click "Test back/forward cache" again,
- You receive site from navigation with error for bfcache which cause by websocket open connection.
When we check the
example from
web.dev with IndexedDB open and close connection it works properly
(
https://bf-cache-websocket.glitch.me/indexedDB.html)
.
You can check the source code in html to check how open and close connection are done.
Do you have some ideas about what is the issue?