CKTIS / JavaScript
PageTransitionEvent.persisted — preserving and restoring documents
PageTransitionEvent carries information for pageshow and pagehide events. Its persisted property distinguishes document restoration from ordinary loading and indicates whether the browser intends to preserve the document for possible reuse.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
event.persisted
new PageTransitionEvent(type, { persisted: boolean })PageTransitionEvent inherits from Event and is the event object type for pageshow and pagehide handled on window. It is a browser Web API interface defined in HTML, not a feature of a particular ECMAScript edition. It does not describe CSS transition animations.
PageTransitionEvent.persisted is a read-only boolean property. For pageshow, true means that a preserved document was restored, typically from the back/forward cache (bfcache); false means no such restoration occurred. It does not test whether the HTTP cache was used. On an initial load, pageshow occurs after load.
On a browser-fired pagehide event, true means the browser intends to preserve the document for possible reuse. It does not guarantee that the document will enter the bfcache or that it will later be restored. In an application, read event.persisted in handlers registered through window.addEventListener("pageshow", handler) or window.addEventListener("pagehide", handler). The restoration branch can refresh data that may have become stale.
MDN marks the interface and property as widely available since July 2015, and the constructor since January 2020. Check constructor support separately; Node 24 does not establish availability of this browser API. The example creates two synthetic events and tests only the branch: it does not trigger navigation or bfcache.
Examples
(() => {
function describePageShow(event) {
return event.persisted ? "restored" : "not restored";
}
for (const persisted of [false, true]) {
const event = new PageTransitionEvent("pageshow", { persisted });
console.log(describePageShow(event));
}
})();Result
not restored restored
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.