Wednesday, April 22, 2009

Creating HTML Signatures in Gmail with Google Chrome

In the last couple of months I've been a heavy user of Google Chrome. I got really addicted to its amazing speed, comparing to IE and Firefox.

Yes, Google Chrome is still under development - there's no fancy interface to extensions yet, Greasemonkey needs a command line switch to be activated and so on. But the speed just makes it worth.

Anyhow, in my Firefox days I used the Black Canvas extension to add HTML signatures to my outgoing Gmail messages. Nothing too fancy -- just a grey text and a link to my blog.
Google Chrome, however, doesn't support such extensions, so I searched for an alternative and found this tool.

This little application creates an inline Javascript that should be dragged to your bookmarks bar, and with a click of a mouse it adds the signature you created into the message. Sounds good, nay?

Well, besides that this generated scripts downloads an external script ( which only god knows what's there, another problem popped up.

When I first used this tool I clicked on the link and nothing happend. No Javascript errors. Nothing. Then I remembered that I'm using the Gmail's lab tasks feature. Closing that window made the script work.

Why not create a smaller, working version, I thought. And I did. There it goes:
javascript:void ((function(){document.getElementById("canvas_frame").contentDocument.getElementsByTagName("iframe")[0].contentDocument.body.innerHTML += "your HTML signature";})())

Where your HTML signature can be a hand-made HTML/CSS code or an auto generated by a WYSIWYG editor like in the tool's page.

So all you need to do is create a new bookmark to this Javascript, and click on it whenever you'd like to add your signature to the mail you're currently sending.

Yeah, it's a hack, so use it on your own risk, blah blah blah.