Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

history

Use thehistory API to interact with the browser history.

If you are looking for information about the browser session history, see theHistory interface.

Note:Downloads are treated asHistoryItem objects. Therefore, events such ashistory.onVisited fire for downloads.

Browser history is a chronological record of pages the user has visited. The history API enables you to:

However, the user may have visited a single page multiple times, so the API also has the concept of "visits". So you can also use this API to:

To use this API, an extension must request the "history"permission in itsmanifest.json file.

Types

history.TransitionType

Describes how the browser navigated to a particular page.

history.HistoryItem

Provides information about a particular page in the browser history.

history.VisitItem

Describes a single visit to a page.

Functions

history.search()

Searches the browser history forhistory.HistoryItem objects matching the given criteria.

history.getVisits()

Retrieves information about visits to a given page.

history.addUrl()

Adds a record to the browser history of a visit to the given page.

history.deleteUrl()

Removes all visits to the given URL from the browser history.

history.deleteRange()

Removes all visits to pages that the user made during the given time range.

history.deleteAll()

Removes all visits from the browser history.

Events

history.onTitleChanged

Fired when the title of a page visited by the user is recorded.

history.onVisited

Fired each time the user visits a page, providing thehistory.HistoryItem data for that page.

history.onVisitRemoved

Fired when a URL is removed completely from the browser history.

Example extensions

Browser compatibility

Note:This API is based on Chromium'schrome.history API. This documentation is derived fromhistory.json in the Chromium code.

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp