MDN self-hosted library · e01.org

NotRestoredReasonDetails: toJSON() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const navEntries = performance.getEntriesByType("navigation");
const navEntry = navEntries[0];
const reason = navEntry.notRestoredReasons.reasons[0];

const json = reason.toJSON();
console.log(json); // A plain object
console.log(typeof json); // "object"
console.log(json.reason); // Same value as reason.reason
js
console.log(JSON.stringify(reason));