← Back to release summary

navigateEvent.intercept()

Category
Miscellaneous
Type
No developer-visible change
Status
Enabled by default (Chrome 105)
Intent stage
Shipped

WPT details: The navigation-api/ directory makes extensive use of transitionWhile(), and we're updating it to use intercept() instead alongside implementation of intercept().

Summary

intercept() works very similarly to the existing navigateEvent.transitionWhile() method, except that instead of taking a mandatory Promise, it takes an optional handler function. We will send a separate Intent to Deprecate and Remove for navigateEvent.transitionWhile().

Motivation

intercept() works very similarly to the already existing navigateEvent.transitionWhile(), except that instead of taking a mandatory Promise, it takes an optional handler function. If a function is provided and it returns a promise, navigation finish will be delayed until the Promise resolves, just as transitionWhile() delays navigation finish for its Promise. This address design problems with transitionWhile(), detailed in https://github.com/WICG/navigation-api/issues/230#issuecomment-1137891972

Standards & signals

Ecosystem

View on chromestatus.com