← Back to release summary

Navigation API: expose destination in navigation.transition

Category
Miscellaneous
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Currently NavigationTransition has a "from" property, exposing the old URL of the navigation. Exposing "to" (a NavigationDestination) completes this. It is especially useful when using precommit handlers, as during precommit the current URL has not yet switched to the destination. Note that navigation.transition is only exposed for intercepted navigations - which means same-origin document-initiated navigations.

Motivation

Exposing things in navigation.transition helps curating the navigation experience without having to listen to *all* navigation events. Specifically, the to/from properties of navigation.transition map nicely to the to/from route matchers (see https://github.com/WICG/declarative-partial-updates/blob/main/route-matching-explainer.md)

Standards & signals

Explainers: https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-to

View on chromestatus.com