Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Cross-Document View Transitions, Render Blocking, and Navigation Events

How multi-page apps opt into cross-document view transitions, defer paint with blocking and expect links, and customize transitions with pagereveal.

This page summarizes how the View Transition API applies to multi-page applications (MPAs): cross-document view transitions, the HTML blocking="render" and <link rel="expect"> controls that keep destination snapshots stable, and the pageswap / pagereveal events defined in the HTML specification. Implementation guidance draws heavily from Chrome for Developers and the WHATWG HTML URL and fetching definitions of blocking attributes.

Section titled “Cross-document view transitions: what triggers them on link navigation”

A cross-document view transition runs when navigation moves from one HTML document to another. Unlike single-page apps, you do not call document.startViewTransition() to start it—the transition is tied to same-origin navigation (for example, a normal link click).

When a view transition occurs between two different documents it is called a cross-document view transition. This is typically the case in multi-page applications (MPA).

— Chrome for Developers, Cross-document view transitions for multi-page applications

The browser reuses the same building blocks as same-document transitions: snapshots of old and new states, a DOM update with rendering suppressed, and CSS-driven animation. Cross-document transitions are supported in Chrome 126+, Edge 126+, and Safari 18.2+; see the support table on the cross-document page.

Cross-document view transitions apply only when both documents share an origin (scheme, host, and port). Navigating from developer.chrome.com to developer.chrome.com/blog qualifies; developer.chrome.com to www.chrome.com does not, because that is cross-origin even when it is same-site.

Opt-in with @view-transition { navigation: auto }

Section titled “Opt-in with @view-transition { navigation: auto }”

Both the outgoing and incoming pages must opt in. The current approach is CSS, not a meta tag:

@view-transition {
navigation: auto;
}

To have a cross-document view transition between two documents, both participating pages need to opt-in to allowing this. This is done with the @view-transition at-rule in CSS.

— Chrome for Developers, Cross-document view transitions for multi-page applications

With navigation: auto, transitions cover traversals and many push/replace navigations, but not address-bar edits, bookmarks, or reloads initiated through browser UI. If preparation takes too long (about four seconds in Chrome), the transition is skipped.

Same-document vs cross-document: when to call startViewTransition

Section titled “Same-document vs cross-document: when to call startViewTransition”
Kind Typical app How it starts Primary reference
Same-document SPA document.startViewTransition(() => { … }) Same-document view transitions
Cross-document MPA Same-origin link navigation when both pages opt in Cross-document view transitions

For SPAs, wrap DOM updates in document.startViewTransition as described in Same Document Transitions. For MPAs, focus on shared CSS (view-transition-name, ::view-transition-old / ::view-transition-new) and destination-page render blocking so the incoming snapshot is not blank or half-styled.

Render-blocking: blocking="render" and the render token

Section titled “Render-blocking: blocking="render" and the render token”

Cross-document glitches often happen because the new page snapshot is taken before critical CSS, scripts, or DOM nodes exist. HTML defines a blocking attribute whose supported token includes render.

A blocking attribute explicitly indicates that certain operations should be blocked on the fetching of an external resource. The operations that can be blocked are represented by possible blocking tokens… "render" — The element is potentially render-blocking.

— WHATWG, URLs and fetching — Blocking attributes

The developer edition restates the same rules in 2.4.6 Blocking attributes. An element is potentially render-blocking when its blocking token set contains render, or when element-specific rules make it implicitly render-blocking (stylesheets in <head> are render-blocking by default).

Consistent Cross-Document Transitions recommends:

  • blocking="render" on <link> or <script> in <head> when a resource must finish before the transition should paint (theme scripts, dynamically injected CSS).
  • <link rel="expect" href="#id" blocking="render"> so painting waits until an element with that id has been parsed (not until images decode).

Use blocking=“render” on critical <link> and <script> elements in the new page’s <head>, and use <link rel="expect"> to block rendering until specific DOM elements have been parsed. This ensures the browser does not begin the view transition animation until the new page’s visual state is stable.

— Chrome for Developers, Consistent Cross-Document Transitions

Parsing continues while paint is deferred—only rendering is held back. Use media on <link rel="expect"> when above-the-fold content differs by viewport, as shown in the consistent cross-document guide.

Scenario What goes wrong without blocking Typical fix
Default root cross-fade Snapshot before <main> exists → cross-fade to empty page <link rel="expect" href="#main-content" blocking="render">
Shared view-transition-name morph Target node missing → morph becomes separate fade in/out rel="expect" on the named element’s id; preload critical images

If the new page’s snapshot is taken before above-the-fold content has been parsed, the cross-fade animates from the old page to a blank or incomplete page.

— Chrome for Developers, Consistent Cross-Document Transitions

<link rel="expect"> guarantees the DOM node exists, not that image bytes are ready. For image morphs, preload (<link rel="preload" as="image">), explicit dimensions, or prerendering are recommended in the same guide and in Cross-document view transitions for multi-page applications.

pageswap and pagereveal: customize transitions before snapshots

Section titled “pageswap and pagereveal: customize transitions before snapshots”

HTML defines navigation events used with cross-document view transitions. They fire on every same-origin cross-document navigation, whether or not a transition runs.

The pageswap event fires before the last frame of a page is rendered… The pagereveal event fires on a page after it has been initialized or reactivated but before the first rendering opportunity.

— Chrome for Developers, Cross-document view transitions for multi-page applications

When a transition is active, event.viewTransition exposes the ViewTransition object. The HTML spec defines PageRevealEvent.viewTransition:

Returns the ViewTransition object that represents an inbound cross-document view transition, if such transition is active when the event is fired. Otherwise, returns null.

— WHATWG, Navigation and session history — PageRevealEvent

See also Edition for Web Developers.

Listeners must run before the first rendering opportunity. Use a parser-blocking <script> in <head>, or <script async blocking="render" src="…"> so registration wins the race—details in Cross-document view transitions for multi-page applications and Consistent Cross-Document Transitions.

Typical uses:

  • Set view-transition-name from navigation context via navigation.activation (Navigation activation).
  • Add view transition types with e.viewTransition.types.add(…) and style via :active-view-transition-type() (Cross-Document Transitions).
  • Call e.viewTransition.skipTransition() when a transition should not run.

Clean up temporary view-transition-name values after viewTransition.finished so bfcache and later navigations stay healthy (Consistent Cross-Document Transitions).

JavaScript feature checks from Cross-Document Transitions:

if ('onpagereveal' in window) {
// Cross-document view transition events available
}
if (window.navigation?.activation) {
// Navigation API activation info available
}

Naming elements and styling the pseudo-tree

Section titled “Naming elements and styling the pseudo-tree”

Assign view-transition-name to elements that should morph between pages. Names must be unique on a given page at snapshot time; duplicates skip the transition (Same-document view transitions).

During an active transition, DevTools can expose the pseudo-tree (::view-transition, ::view-transition-group(root), …) for live CSS edits—see Animations: Inspect and modify CSS animation effects.

Nested groups and element-scoped transitions (advanced)

Section titled “Nested groups and element-scoped transitions (advanced)”

By default, view-transition pseudo-elements form a flat sibling tree, which breaks clipping, masks, and some 3D effects. view-transition-group: contain (or nearest on children) nests groups so ::view-transition-group-children() can apply overflow: clip—see Prevent clipping issues with nested view transition groups.

Element-scoped transitions call element.startViewTransition() on a subtree so the overlay does not cover the whole document—useful for lists and concurrent animations (Element-scoped view transitions, Scoped Component Transitions). That is primarily a same-document pattern but shares naming and nesting concepts with MPAs.

  • Opt-in on only one page — both documents need @view-transition { navigation: auto; }.
  • Duplicate view-transition-name on one page — transition skipped (Same-document view transitions).
  • Late pagereveal listener — event may fire before your script runs; use blocking="render" on the setup script.
  • Expecting rel="expect" to wait for images — only DOM parse; add preload and sizing.
  • Leaving temporary names — breaks bfcache and later navigations.
  • Blocking non-critical third parties — risks timeout and skipped transitions.
  1. Confirm both participating URLs are same-origin and each response includes @view-transition { navigation: auto; } (view page CSS in DevTools or your build output).

  2. On the destination page, verify <link rel="expect" … blocking="render"> and any blocking="render" scripts appear in <head> and reference real element IDs (Consistent Cross-Document Transitions).

  3. Navigate via an in-site link (not the address bar) in a supporting browser and watch for a skipped transition or flash of unstyled content; compare with guidance in Cross-document view transitions for multi-page applications.

  4. Open Animations: Inspect and modify CSS animation effects, pause, trigger a navigation, and inspect ::view-transition pseudo-elements if you customize animations.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about so it can be corrected or explained.