Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. NavigationHistoryEntry

NavigationHistoryEntry

Baseline 2026
Newly available

Since January 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

TheNavigationHistoryEntry interface of theNavigation API represents a single navigation history entry.

These objects are commonly accessed via theNavigation.currentEntry property andNavigation.entries() method.

The Navigation API only exposes history entries created in the current browsing context that have the same origin as the current page (e.g., not navigations inside embedded<iframe>s, or cross-origin navigations), providing an accurate list of all previous history entries just for your app. This makes traversing the history a much less fragile proposition than with the olderHistory API.

EventTarget NavigationHistoryEntry

Instance properties

Inherits properties from its parent,EventTarget.

idRead only

Returns theid of the history entry. This is a unique, UA-generated value that always represents a specific history entry, useful to correlate it with an external resource such as a storage cache.

indexRead only

Returns the index of the history entry in the history entries list (that is, the list returned byNavigation.entries()), or-1 if the entry does not appear in the list.

keyRead only

Returns thekey of the history entry. This is a unique, UA-generated value that represents the history entry's slot in the entries list rather than the entry itself. It is used to navigate that particular slot viaNavigation.traverseTo(). Thekey will be reused by other entries that replace the entry in the list (that is, if theNavigateEvent.navigationType isreplace).

sameDocumentRead only

Returnstrue if this history entry is for the samedocument as the currentDocument value, orfalse otherwise.

urlRead only

Returns the absolute URL of this history entry. If the entry corresponds to a different document than the current one (likesameDocument property isfalse), and that document was fetched with aReferrer-Policy header set tono-referrer ororigin, the property returnsnull.

Instance methods

Inherits methods from its parent,EventTarget.

getState()

Returns a clone of the available state associated with this history entry.

Events

dispose

Fires when the entry is no longer part of the history entry list.

Examples

js
function initHomeBtn() {  // Get the key of the first loaded entry  // so the user can always go back to this view.  const { key } = navigation.currentEntry;  backToHomeButton.onclick = () => {    navigation.traverseTo(key);  };}// Intercept navigate events, such as link clicks, and// replace them with single-page navigationsnavigation.addEventListener("navigate", (event) => {  event.intercept({    async handler() {      // Navigate to a different view,      // but the "home" button will always work.    },  });});

Specifications

Specification
HTML
# the-navigationhistoryentry-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp