Skip to content

Available Data

David Lawes edited this page Oct 15, 2018 · 1 revision

Available APIs for Chrome History

Chrome APIs

Chrome has an API for accessing the browser history: https://developer.chrome.com/extensions/history

It allows your scripts to interact with the browser's record of visited pages.

From examples it looks like the API calls have to exist from within background js files, as opposed to content js files.

JS API Calls

JS can make API calls to the browser too - it suggests creating an extension to the browser to achieve the additional functionality. Here's a good article about the anatomy of an extension: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension

Data Stored Natively in Chrome

Fundamentally, Chrome does not store the duration spent on a specific URL, so we need to add extra logic (eventlisteners, eventhandlers?) to manage this requirement.

In Chrome the browsing history stores things like:

  • URL visited
  • When URL was visited
  • How many times URL was visited

The duration of the URL is measured based on if you clicked when the page loaded - so may not be a good representation of time spent on the page.