← Back to release summary

Navigation API: deferred commit (precommit handlers)

Category
Miscellaneous
Type
New or changed feature
Status
In development (Chrome In development)
Intent stage
Start prototyping

Summary

Normally, when navigateEvent.intercept() is called, the intercepted navigation commits (and therefore the URL updates) as soon as the NavigateEvent finishes dispatch. Adding a `precommitHandler` option to navigateEvent.intercept(), similar to `handler`, would defer the commit until that handler (and all other precommit handlers) are resolved, also allowing the handler to change the navigation's URL, info, status, and history handling behavior (push/replace).

Motivation

In developing the navigation API, we heard feedback (https://github.com/WICG/navigation-api/issues/66) that our current policy of immediately committing the navigation does not match with how routing libraries currently model asynchronous same-document navigations.

Standards & signals

Explainers: https://github.com/WICG/navigation-api#precommit-handlers

View on chromestatus.com