NavigationCurrentEntryChangeEvent
Baseline 2026Newly available
Since January 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
TheNavigationCurrentEntryChangeEvent interface of theNavigation API is the event object for thecurrententrychange event, which fires when theNavigation.currentEntry has changed.
This event will fire for same-document navigations (e.g.,back() ortraverseTo()), replacements (i.e., anavigate() call withhistory set toreplace), or other calls that change the entry's state (e.g.,updateCurrentEntry(), or theHistory API'sHistory.replaceState()).
This event fires after the navigation is committed, meaning that the visible URL has changed and theNavigationHistoryEntry update has occurred. It is useful for migrating from usage of older API features like thehashchange orpopstate events.
In this article
Constructor
NavigationCurrentEntryChangeEvent()Creates a new
NavigationCurrentEntryChangeEventobject instance.
Instance properties
Inherits properties from its parent,Event.
fromRead onlyReturns the
NavigationHistoryEntrythat was navigated from.navigationTypeRead onlyReturns the type of the navigation that resulted in the change.
Examples
Navigation data reporting:
navigation.addEventListener("currententrychange", () => { const data = navigation.currentEntry.getState(); submitAnalyticsData(data.analytics);});Setting up a per-entry event:
navigation.addEventListener("currententrychange", () => { navigation.currentEntry.addEventListener("dispose", genericDisposeHandler);});Specifications
| Specification |
|---|
| HTML> # the-navigationcurrententrychangeevent-interface> |