Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. NavigationCurrentEntryChangeEvent

NavigationCurrentEntryChangeEvent

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

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.

Event NavigationCurrentEntryChangeEvent

Constructor

NavigationCurrentEntryChangeEvent()Experimental

Creates a newNavigationCurrentEntryChangeEvent object instance.

Instance properties

Inherits properties from its parent,Event.

fromRead onlyExperimental

Returns theNavigationHistoryEntry that was navigated from.

navigationTypeRead onlyExperimental

Returns the type of the navigation that resulted in the change.

Examples

Navigation data reporting:

js
navigation.addEventListener("currententrychange", () => {  const data = navigation.currentEntry.getState();  submitAnalyticsData(data.analytics);});

Setting up a per-entry event:

js
navigation.addEventListener("currententrychange", () => {  navigation.currentEntry.addEventListener("dispose", genericDisposeHandler);});

Specifications

Specification
HTML
# the-navigationcurrententrychangeevent-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp