/chrome-export-history

Chrome Extension to export your entire history in json or csv

Primary LanguageCSS

Export History

A Chrome extension to export your history as csv or json.

Forked edition retrieving visits information along with each history item.

Usage

Clone this repository:

$ git clone github.com:christiangenco/chrome-export-history.git

and run

$ bower install

to install the needed dependencies.

Then visit the extensions panel of your chrome settings, check developer mode, click Load unpacked extension, and select the directory you just cloned (for a more detailed explanation of these steps, visit Chrome's Getting Started: Building a Chrome Extension page).

Most of the logic is contained in popup.js. The method that makes the magic happen is chrome.history.search, but trying to convert the entire object returned in memory makes Chrome crash.

The workaround used by this extension is to convert each object of the returned results array individually and append it to a hidden div, #data. For whatever reason, the DOM has a much higher memory tolerance than javascript objects in chrome extensions.

The data in #data is then converted to a Blob and encoded to a data URI, which you can do like this:

var blob = new Blob([SOME_DATA], {type: 'application/octet-binary'});
var url = URL.createObjectURL(blob);

And then that url is stuck into a link and clicked on so it downloads as a file, which you can do like this:

var pom = document.createElement('a');
pom.setAttribute('href', url);
pom.setAttribute('download', filename);
pom.click();

Direct any questions to @cgenco if you get stuck.

License

Do whatever you want with this - but if you make money on it, I want some.