You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve History State after Cross-Document Navigation #1441
Currently, Blink and WebKit discard the developer-supplied history entry state after a cross-document navigation, but retain the state during a same-document navigation.
This behavior is inconsistent and makes passing data to a navigation target highly complex.
The current behavior of Gecko is more consistent, as the state is always preserved after any navigation.
The ability to seamlessly pass state across documents is critical for web apps that aren't strictly single-page. Resolving this cross-browser discrepancy will significantly lower friction for modern web state handling and allow developers to drop hacky storage-based fallbacks.
This comment was automatically generated based on the information you provided. Please don't edit it.
Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
If this doesn't accurately correspond to your proposal, please update your initial comment to include web-features: <feature-id>.
To find feature IDs, use the web-features explorer.
Feature Navigation API
ID: navigation
Name: Navigation API
Description: The navigation API initiates, intercepts, or modifies browser navigation actions. Not to be confused with the navigator API.
I ranked this highly on Mozilla's survey of which features to include, but that was not necessarily a vote for the behavior the OP proposes. It's a vote for fixing any interop issue here according to the most reasonable interpretation of the spec, because the brand-new navigation API having interop issues is very sad.
(I cannot quite tell what the OP is suggesting, but if it's that updateCurrentEntry() should somehow also cause future entries to update, that seems unlikely to be correct.)
I suggest all engines align with Gecko's current behavior here. This means that after clicking the "NEXT" button in a.html, the browser should navigate to b.html, and calling both navigation.currentEntry.getState() and navigation.activation.entry.getState() should return ["XYZ"].
The call to navigation.updateCurrentEntry in a.html was simply my attempt to leave a marker for easier inspection later; in hindsight, it is not truly necessary.
I used AI to check what the spec requires. It says Chromium and WebKit follow the current spec in this case:
The spec requires undefined here. The navigate() method says state "will be ignored for navigations that end up cross-document." The navigate algorithm matches: it passes navigationAPIState only to the navigate event's destination, then creates the new session history entry without it. That entry keeps the initial navigation API state, StructuredSerializeForStorage(undefined). Cross-document reload({state}) works the same way: reload exposes the new state on event.destination and never writes it to the entry. Chrome Canary and Safari TP return undefined from currentEntry.getState() and activation.entry.getState() on b.html. Firefox Nightly returns ["XYZ"].
Dropping state on cross-document navigations was intentional. Domenic raised it in WICG/navigation-api#98 (2021). His concern: "giving a new way to pass state across documents seems a bit fraught. At the very least it'd have to be origin-constrained." He closed it as "let's leave this as no". In WICG/navigation-api#100, a web developer reported that automatically carrying state forward led to it being misused as a sessionStorage substitute. Gecko's behavior seems to come from https://bugzilla.mozilla.org/show_bug.cgi?id=1966674, which was about plumbing state into NavigateEvent.destination. Part 6 of that bug also copies the state into the new session history entry, with no rationale given, so I think it's a Gecko bug. I couldn't find a wpt test for this case, which may be why nobody noticed.
Activity
github-actions commentedon Sep 22, 2026
This comment was automatically generated based on the information you provided. Please don't edit it.
Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
If this doesn't accurately correspond to your proposal, please update your initial comment to include
web-features: <feature-id>.To find feature IDs, use the web-features explorer.
Feature Navigation API
navigationAPI initiates, intercepts, or modifies browser navigation actions. Not to be confused with thenavigatorAPI.domenic commentedon Oct 9, 2026
I ranked this highly on Mozilla's survey of which features to include, but that was not necessarily a vote for the behavior the OP proposes. It's a vote for fixing any interop issue here according to the most reasonable interpretation of the spec, because the brand-new navigation API having interop issues is very sad.
(I cannot quite tell what the OP is suggesting, but if it's that
updateCurrentEntry()should somehow also cause future entries to update, that seems unlikely to be correct.)sunhaitao commentedon Oct 9, 2026
I suggest all engines align with Gecko's current behavior here. This means that after clicking the "NEXT" button in
a.html, the browser should navigate tob.html, and calling bothnavigation.currentEntry.getState()andnavigation.activation.entry.getState()should return["XYZ"].The call to
navigation.updateCurrentEntryina.htmlwas simply my attempt to leave a marker for easier inspection later; in hindsight, it is not truly necessary.jgraham commentedon Oct 21, 2026
Are there bugs filed against Chromium or WebKit for this?
zcorpan commentedon Oct 21, 2026
I used AI to check what the spec requires. It says Chromium and WebKit follow the current spec in this case:
Using the web-archeologist skill to find out about the rationale:
zcorpan commentedon Oct 21, 2026
Tests: web-platform-tests/wpt#64000
zcorpan commentedon Oct 22, 2026
Filed https://bugzilla.mozilla.org/show_bug.cgi?id=2084868