Gmail 2 Logo We just wrote about how Gmail 2 breaks a lot of the Greasemonkey scripts that are available, and Gina from Lifehacker turned right around and released Better Gmail 2. As expected this version only has a fraction of scripts that the original extension had, and it still lacks some of my favorites: Google Calendar integration, Google Reader integration, and Folders4Gmail. None of those scripts have been made compatible with Gmail 2 yet.

One script that I have to have is one for automatically inserting HTML signatures into my emails. The script I used previously wasn’t all that complicated, and I decided to go ahead and fix it myself. I took it one step further, however, and made it work with both the new version and the old version of Gmail.

Note: This script is designed to insert your signature at the beginning of replies/forwards, instead of at the end.

Here’s what you have to do:

  1. Download and install Greasemonkey if you don’t already have it.
  2. Install the script
  3. You’ll need to have the HTML code for the signature that you want to insert. Once you have that just go to the Greasemonkey script manager and edit the script’s HTML signature. The code looks something like this (insert the signature where you see the green text):

    var htmlSignature = ‘<br>–<br>Ryan Wagner, Founder/Editor<br><a href=””>CyberNet Technology News</a><br><a href=””><img src=”” style=”border:0″ alt=”CyberNet Technology News”/></a>‘;

    top.window.setTimeout(“top.window.frames['main'].frames['" + + "'].document.getElementById(‘hc_compose’).contentWindow.document.getElementsByTagName(‘body’)[0].innerHTML = ‘” + htmlSignature + “‘ + top.window.frames['main'].frames['" + + "'].document.getElementById(‘hc_compose’).contentWindow.document.getElementsByTagName(‘body’)[0].innerHTML;”,500);

    var allBody = document.evaluate(“//body[@class='editable tr-field']“, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    allBody.snapshotItem(0).innerHTML = htmlSignature + allBody.snapshotItem(0).innerHTML;

This script does work with Opera, but only with the older version of Gmail. I used a special Firefox-only searching property to insert the signature for the new version of Gmail, and the reason being that Gmail 2 has some issues in Opera. In fact Opera users won’t even see a link to the newer version of Gmail unless they are masking the browser as Firefox or IE.

There Are 21 Comments

  1. Hi, thanks for your work porting the script to the new Gmail version, but for me it’s not working… It’s installed correctly and I’ve tried changing or leaving your html sign. Whatever the case it’s always displaying the signature in the setup of gmail and not the html one. I’ve also put the html sign in the gmail settings but it’s displaying the html code inline, not the desired html rendering.

  2. Same here. It works with Gmail 1, but not Gmail 2. Also, in Gmail 1, it does not work with replies.

  3. same here, does not work in gmail 2

  4. I fourth this. Thanks for the effort though, I really want this script back! :)

  5. Hmmm, it works for me in Firefox 3 with Greasemonkey. I’ll have to try it out in Firefox 2. Thanks for the heads up.

  6. Hi, anything new to work with Firefox 2 and Gmail 2 with HTML Signature?

  7. This script not working for me in ff2 w/greasemonkey.

  8. Unfortunately I haven’t had time to work on the script. One thing that I forgot to mention was that the URL’s only work for the .COM version of Gmail, so if you’re using Gmail in a different country you’ll need to update that part of the code.

  9. dont work even with all update and latest update to Grease monkey (jan 22)

  10. ff2 with latest Grease Monkey version installed (today). No luck.

    Works fine for me in GMail v.1, but nothing in v.2

    Thanks for trying though.

  11. Are you guys using it on a domain other than .COM?

  12. Here’s an idea, how about just the signatures?

  13. PLEASE build a signature only extension, otherwise I will be forced to use outlook for this reason and only for this reason.

  14. Don’t Worry!

    Install Greasemonkey Firefox add-on

    Install Gmail HTML Signatures

    Be Happy!

  15. Nice find Rodolpho, but now I’m just trying to figure out how to setup my signature with it.

  16. Awesome, the original gmail signatures has been updated :-). FYI, it only works with Gmail 2.

    To Ryan: Go into gmail itself, and set it up there. No need to edit the script directly.

  17. Justin Goldberg wrote:
    Awesome, the original gmail signatures has been updated :-). FYI, it only works with Gmail 2.

    To Ryan: Go into gmail itself, and set it up there. No need to edit the script directly.

    I did realize that’s how to set it up, but it took me a minute to notice that the script isn’t compatible with Firefox 3. That’s where my problem lied.

  18. :D HTML Signatures for Gmail 2 Working with FF3 beta 4

    Gmail HTML Signatures not working wery well with FF3 :(

Leave Your Comment

Message is the only required field.
Emails are not published.