← Back to release summary
navigateEvent.intercept()
- Category
- Miscellaneous
- Type
- No developer-visible change
- Status
- Enabled by default (Chrome 105)
- Intent stage
- Shipped
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
- Specification: https://github.com/WICG/navigation-api/pull/235
- Firefox: No signal — https://github.com/mozilla/standards-positions/issues/543 remains open as the positions request for the original API.
- Safari: No signal — https://www.mail-archive.com/webkit-dev@lists.webkit.org/msg30257.html remains open as the positions request for the original API.
- Web developers: Positive — Positive. The problem this was solving was discovered by a web developer in https://github.com/WICG/navigation-api/issues/230, and has some engagement there. The bonus of no longer having to pass an empty promise also addresses some feedback we've heard in the past.
- Tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1336000
View on chromestatus.com