My first Chrome extension – Google Web History Updater

Google Web History Updater extension icon

Google Web History Updater extension icon

I’ve created my first extension for Google Chrome – Google Web History Updater!

One of my favorite features of the Google Toolbar is that it records your browsing history in Google Web History.  If you don’t like that feature or are paranoid about Google keeping information about you then you might as well stop reading now.

The benefits of Google Web History are that Google uses your history to personalize your search results, and that you can track down a site you visited while on another computer.

Unfortunately Google Toolbar isn’t available in Chrome.  The reasons for this are fairly clear (Chrome doesn’t do toolbars at all because of its minimalist aesthetic) but I still missed my Google Web History.

Several people entered bug reports for adding Toolbar’s features to the browser, but I got tired of waiting and decided to try and make an extension that would update Web History.  I quickly hit a dead end and contacted the Chrome developers to ask them for help.  They said there was no published API for updating Web History and suggested I reverse engineer the way Toolbar does it.  I couldn’t work out how to do it, and the developers said that the Toolbar team were thinking about making an official extension to do it, so I waited some more.

Then I read an article that reminded me that some browsers (Opera) have had this problem for a long time, and there was a solution available for them – the UseGoogleWebHistory userscript.  This is a small javascript file that runs whenever a page loads, and sends the URL to Web History.  I could have converted the userscript to an extension pretty easily or even had the conversion done for me automatically using a new feature of Chrome but although the userscript worked, it didn’t work for every URL.  I couldn’t work out what was wrong with it, so I went looking for another solution.

It turns out that sending a URL to Web History is actually done as a side effect of asking Google for the PageRank of the URL.  This means that PageRank extensions like this one actually do exactly what I want, except that they also take up space on the screen.

I ended up just modifying that extension (mostly just removing the UI) so I can’t take much credit, but the majority of the code is lifted from the Toolbar anyway.

In the end I got what I wanted – Chrome updating Web History.

EDIT: The toolbarqueries.google.com URL does’t seem to be working at all anymore.  I suspect that Google has retired that functionality.  The writing has been on the wall for a long time as it was part of Google Toolbar which Google discontinued.  I think I’m going to have to remove this extension as it no longer works.

Enhanced by Zemanta