Friday, May 31, 2013

Script to recover the old gmail favicon

Update: I've noticed this is getting many page views lately. Unfortunately, it no longer works. Google learned about leaving their old icon in the servers and changed it too. The only solution I can think of is hosting the old icon somewhere else and changing the url in the following script to use that hosted icon.

Yesterday gmail changed the favicon.

I don't like the new one. I wonder if the designer has ever witnessed the effects of lightning in a real life envelope. Shadows don't do that :).

This is serious business for me, because I am in front of a computer most of my life. And most of the time I am in front of a computer, it is looking at my browser window. And most of the time I am looking at my browser window, the gmail icon is the one in the first pinned app.

But I am a programmer, and I know how to workaround issues. I always have greasemonkey installed in firefox. It is an addon that allows me to specify some javascript scripts to run when visiting specific pages. All I had to do was to create a script that could change the favicon...

With some research, I found out that when google changed the icon, they didn't replace the old file. Instead they just created a new one. So all that the script needed was to change the address. A google search for "Change favicon with javascript" took me to a stackoverflow thread: http://stackoverflow.com/questions/260857/changing-website-favicon-dynamically/260876#260876

So here is the link to the userscripts.org entry: http://userscripts.org/scripts/show/169207. And here is the script itself:

// ==UserScript==
// @name old favicon
// @namespace nouglyenvelopeshadow
// @description Changes gmail's favicon back to the old one
// @include http*://mail.google.com*
// @version 1
// @grant none
// ==/UserScript==
(function() {
var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = '/mail/u/0/images/favicon.ico';
document.getElementsByTagName('head')[0].appendChild(link);
}());

No comments :