Home > Hacking, JavaScript, Mozilla Firefox > Firefox’s Built in SQLite History Database

Firefox’s Built in SQLite History Database

As of Firefox 3.0, the history and bookmarks have been stored in an SQLite instance that is natively available. You can actually interact with this database using the following JavaScript code snippet.  Now all you need is the person’s name, and voila, you know their entire browsing history !

How do you get their name, well, ask them! Provide a textbox and some incentive, and you’ll have their name and email soon enough.

Warning: I have only run this script locally, and do not know as yet how it behaves if you load it off a remotely accessed web page. If you do manage to get this working remotely, please leave a note in the comments.

Querying the Mozilla Places SQLite Datastructure

//Create Useful Shorthand Notations
var Cc = Components.classes;
var Ci = Components.interfaces;
var rc = Cc[“@mozilla.org/browser/nav-history-service;1”];
var rs = rc.getService(Ci.nsINavHistoryService);
var myquery = rs.getNewQuery(); //returns nsINavHistoryQuery
var myqueryoptions = rs.getNewQueryOptions(); // return sINavHistoryQueryOptions

//Execute the query on the History Object

var myresult = rs.executeQuery(
); // returns nsINavHistoryResult

var node = myresult.root; //Of type nsINavHistoryResultNode;

//Parse the results, and collect the URLS in the following string

var collect_string = “”;

//var node = result.root;
node.containerOpen = true;
for (var i = 0; i < node.childCount; i ++) {
var node_new = node.getChild(i);
collect_string += node_new.uri + “\n”;
node.containerOpen = false;


  1. No comments yet.
  1. No trackbacks yet.