Saturday, August 18, 2007

Hendricks Solutions Web History

Google's web history application is quite useful. At least for Google searches. To expand web history beyond searches, one must install Google's Toolbar. I don't like browser toolbars and haven't installed Google's, so I only see searches in my history.

About once a month, I use search history to find a page I looked at earlier but am unable to track down again through other means. As the first step towards getting a convenient, browsable history of my browsing, tonight I implemented Hendricks Solutions Web History.

It's just a simple Greasemonkey script that shoots off an XMLHttpRequest with the URI, timestamp and page title of the web page that just loaded. It looks something like this:

// ==UserScript==
// @name           Where have I been
// @namespace      http://www.ndrix.com
// @description    Submit an AJAX request registering every URI Firefox visits
// @include        *
// ==/UserScript==
var uri   = location.href;
var title = document.title;
var time  = Math.round((new Date()).getTime()/1000 );

var get_this = "http://www.example.com/foo.pl"
             + "?time="  + time
             + "&uri="   + encodeURIComponent(uri)
             + "&title=" + encodeURIComponent(title)
             ;
GM_xmlhttpRequest({
    method : "GET",
    url    : get_this,
    onload : function () { return },
});

On the server there's a small Perl script that collects that information and appends it to a log. Now I have a central repository of all the webpages I ever visit. Sometime I'll hack on a pretty front end.

0 comments: