Use the browser.history API to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see Override Pages.

Permissions: history

Not allowed in: Content scripts, Devtools pages

_AddUrlDetails
_DeleteRangeRange
_DeleteUrlDetails
_GetVisitsDetails
_OnTitleChangedChanged
_OnVisitRemovedRemoved
_SearchQuery
HistoryItem
VisitItem
TransitionType
onTitleChanged
onVisited
onVisitRemoved
addUrl
deleteAll
deleteRange
deleteUrl
getVisits
search
TransitionType:
    | "link"
    | "typed"
    | "auto_bookmark"
    | "auto_subframe"
    | "manual_subframe"
    | "generated"
    | "auto_toplevel"
    | "form_submit"
    | "reload"
    | "keyword"
    | "keyword_generated"

The transition type for this visit from its referrer.

onTitleChanged: WebExtEvent<(changed: _OnTitleChangedChanged) => void>

Fired when the title of a URL is changed in the browser history.

onVisited: WebExtEvent<(result: HistoryItem) => void>

Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded.

onVisitRemoved: WebExtEvent<(removed: _OnVisitRemovedRemoved) => void>

Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history.

  • Adds a URL to the history with a default visitTime of the current time and a default transition type of "link".

    Parameters

    Returns Promise<void>

  • Deletes all items from the history.

    Returns Promise<void>

  • Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.

    Parameters

    Returns Promise<void>

  • Removes all occurrences of the given URL from the history.

    Parameters

    Returns Promise<void>

  • Searches the history for the last visit time of each page matching the query.

    Parameters

    Returns Promise<HistoryItem[]>