A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.chrome.com/docs/extensions/reference/api/history below:

chrome.history | API | Chrome for Developers

Skip to main content chrome.history

Stay organized with collections Save and categorize content based on your preferences.

Description

Use the chrome.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

To interact with the user's browser history, use the history API.

To use the history API, declare the "history" permission in the extension manifest. For example:

{
  "name": "My extension",
  ...
  "permissions": [
    "history"
  ],
  ...
}
Concepts and usage Transition types

The history API uses transition types to describe how the browser navigated to a particular URL on a particular visit. For example, if a user visits a page by clicking a link on another page, the transition type is "link". See the reference content for a list of transition types.

Examples

To try this API, install the history API example from the chrome-extension-samples repository.

Types

HistoryItem

An object encapsulating one result of a history query.

Properties Enum

"link"
The user arrived at this page by clicking a link on another page.

"typed"
The user arrived at this page by typing the URL in the address bar. This is also used for other explicit navigation actions.

"auto_bookmark"
The user arrived at this page through a suggestion in the UI, for example, through a menu item.

"auto_subframe"
The user arrived at this page through subframe navigation that they didn't request, such as through an ad loading in a frame on the previous page. These don't always generate new navigation entries in the back and forward menus.

"manual_subframe"
The user arrived at this page by selecting something in a subframe.

"generated"
The user arrived at this page by typing in the address bar and selecting an entry that didn't look like a URL, such as a Google Search suggestion. For example, a match might have the URL of a Google Search result page, but it might appear to the user as "Search Google for ...". These are different from typed navigations because the user didn't type or see the destination URL. They're also related to keyword navigations.

"auto_toplevel"
The page was specified in the command line or is the start page.

"form_submit"
The user arrived at this page by filling out values in a form and submitting the form. Not all form submissions use this transition type.

"reload"
The user reloaded the page, either by clicking the reload button or by pressing Enter in the address bar. Session restore and Reopen closed tab also use this transition type.

"keyword"
The URL for this page was generated from a replaceable keyword other than the default search provider.

"keyword_generated"
Corresponds to a visit generated for a keyword.

Properties

VisitItem

An object encapsulating one visit to a URL.

Properties Methods

addUrl()

chrome.history.addUrl(
  details: UrlDetails,
  callback?: function,
)

Adds a URL to the history at the current time with a transition type of "link".

Parameters Returns

deleteAll()

chrome.history.deleteAll(
  callback?: function,
)

Deletes all items from the history.

Parameters Returns

deleteRange()

chrome.history.deleteRange(
  range: object,
  callback?: function,
)

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

deleteUrl()

chrome.history.deleteUrl(
  details: UrlDetails,
  callback?: function,
)

Removes all occurrences of the given URL from the history.

Parameters Returns

getVisits()

chrome.history.getVisits(
  details: UrlDetails,
  callback?: function,
)

Retrieves information about visits to a URL.

Parameters Returns

search()

chrome.history.search(
  query: object,
  callback?: function,
)

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

Parameters Returns Events

onVisited

chrome.history.onVisited.addListener(
  callback: function,
)

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

Parameters

onVisitRemoved

chrome.history.onVisitRemoved.addListener(
  callback: function,
)

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

Parameters

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-05-24 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-05-24 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3