Web facing PSA: navigation API timing changes to avoiding spurious `navigateerror` firing

9 views
Skip to first unread message

Noam Rosenthal

unread,
12:17 PM (5 hours ago) 12:17 PM
to blink-dev, Nate Chapin
As part of the interop 2026 effort to align navigation API
implementations across browsers, we've made a few subtle behavior
changes to the navigation API. Most users should not be affected. The
main impact is avoiding `navigateerror` events from firing when no
error occurred.

The changes are as follows:
(1) A navigation succeeds synchronously if it is not synchronously
intercepted/aborted. Before this change, navigating multiple times in
the same synchronous execution (e.g. calling `location.href` with a
hash multiple times) would trigger `navigateerror` because every
navigation "aborts" the previous one.

This occurred because the navigation required at least one microtask
to be considered successful.

(2) A successful cross-document navigation is cleared from the state,
so it doesn't fire a `navigateerror` when returning to the page from
BFCache.

Both changes are spec-compliant, covered with WPT, and interoperable
with Mozilla.
Reply all
Reply to author
Forward
0 new messages