This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The PageTransitionEvent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded.
PageTransitionEvent()Creates a new PageTransitionEvent object.
This interface also inherits properties from its parent, Event.
PageTransitionEvent.persisted Read only
Indicates if the document is loading from a cache.
<!doctype html> <html lang="en-US"> <body></body> </html>
window.addEventListener("pageshow", (event) => {
if (event.persisted) {
alert("The page was cached by the browser");
} else {
alert("The page was NOT cached by the browser");
}
});
| Specification |
|---|
| HTML> # the-pagetransitionevent-interface> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
PageTransitionEvent |
16 | 79 | 11 | 15 | 6 | 18 | 14 | 14 | 6 | 1.0 | 4.4 | 6 |
PageTransitionEvent |
4 | 12 | 1.5 | 15 | 5 | 18 | 4 | 14 | 4 | 1.0 | 4.4 | 4 |
persisted |
4 | 12 | 11 | 15 | 5 | 18 | 14 | 14 | 4 | 1.0 | 4.4 | 4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent