coderef

Navigation precommit handlersLimited availability

The precommitHandler callback option to NavigateEvent's intercept() method returns a promise that defers navigation until the promise resolves. You can use this to change the navigation's URL, state, and history before navigation occurs.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–145Not supported
146+Supportedsince Mar 10, 2026
Current: 155
Edge
12–145Not supported
146+Supportedsince Mar 13, 2026
Current: 154
Firefox
1–147Not supported
148+Supportedsince Feb 24, 2026
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–145Not supported
146+Supportedsince Mar 10, 2026
Current: 155
Firefox Android
4–147Not supported
148+Supportedsince Feb 24, 2026
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Safari, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: NavigationPrecommitController.

Feature detection

JS · check before using
if ("NavigationPrecommitController" in globalThis && "addHandler" in NavigationPrecommitController.prototype) {
  // NavigationPrecommitController.addHandler is available
}

Sub-features

Support for each part of the feature (4). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
NavigateEvent.intercept.precommitHandler_option141141147✕141147✕
NavigationPrecommitController141141147✕141147✕
NavigationPrecommitController.addHandler146146148✕146148✕
NavigationPrecommitController.redirect141141147✕141147✕