window.addEventListener("pageswap", (event) => {
// For example, the page was hidden, or the navigation is cross-document.
if (!event.viewTransition) return;
// Skip the view transition for back/forward navigations.
if (event.activation.navigationType === "traverse") {
event.viewTransition.skipTransition();
}
});NavigationActivation: navigationType property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.