jargon

Comparison

Back-forward cachevsPage visibility

Back-forward cache

you pressed back and the previous page appeared instantly, exactly as you left it, with no requests.

The browser freezing a whole page — DOM, heap, scroll position — when you navigate away, and restoring it on back or forward. It makes history navigation effectively free, and it is disabled by a list of things: an `unload` handler, `no-store` on the document, an open connection the browser will not freeze. The `pageshow` event with `persisted` set is how you detect a restore and refresh anything that has gone stale.

Full entry →

Page visibility

you stopped the polling when the tab went to the background and started it again when it came back.

An event and property telling you whether the page is currently visible, which is how you avoid doing work for a tab nobody is looking at. It is also the reliable place to flush state before the page goes away, because `visibilitychange` to hidden is the last event guaranteed to fire on mobile. `unload` and `beforeunload` are not reliable and disable the back-forward cache into the bargain.

Full entry →

Related comparisons