Monday, January 05, 2009

Hacking the registry to make Chrome and GMail work together

For a long time, I've been copy-pasting e-mail addresses into GMail if I've needed to use them from a link.  While it's not as annoying as you might think, it's still dumb and irritating.  So today I decided to change that.  Some research on the internet found me the registry key that controls the handling of mailto: links.  Note that I'm using Windows Vista; I think that the registry structure in previous Windows versions is enough different for this not to work verbatim.  The pertinent key is HKEY_CLASSES_ROOT\mailto\shell\open\command.  In my registry, there's only one value there.  Change the data in the key to

C:\Users\username\AppData\Local\Google\Chrome\Application\chrome.exe http://mail.google.com/mail/?extsrc=mailto&url=%1

Substitute your Windows username for username in my example line above.  The reason I had to do this is for whatever reason, GMail Notifier was unable to override Outlook when I told it to make GMail and Chrome my default mail handler.  Probably because Windows Vista is a PITA and Chrome's support by other programs, even Google programs, is still a bit funky.

For those who are curious about how this works (and don't know immediately by looking at it,) here's what's going on...  The registry key's data is exactly the same as something you'd enter in the command line.  In fact, when I was experimenting with the path and how to include the address I wanted Chrome to open, I used the command line.  Then I copy-pasted the succesful command into the field in regedit where I could change the value of the key.  %1 is a placeholder for the piece of data being passed to the command.  I had to play with that a little to make it work because I wasn't sure if the mailto: part was included automatically or not.  It turns out it is, which is why you don't see it in the registry key above.  Chrome is smart enough to open a tab, not a whole new window, when it gets started this way, which is nice because it saves learning more about how to operate it from a command line.

In the spirit of credit where credit is due, I figured out a lot of this based on someone else's registry key.  Check out Shonzilla's blog.  I think that perhaps his version would work on a previous Windows version?

4 comments:

Wade said...

for windows xp use this:

C:\Documents and Settings\username\Local Settings\Application Data\Google\Chrome\Application\chrome.exe --app=https://mail.google.com/mail/?extsrc=mailto&url=%1

and it will also open gmail as a chrome application instead of just as a webpage

Ripple Alliance said...

this didn't work for me on vista... do you have quotes around anything? or is that exactly what is in the "Value Data" field in the registry?

Thanks for posting, hope I can get it working!

Tyler

Andrew said...

That's exactly what I have in my registry key, except for substituting my username. No quotes or anything. Assuming you copied the second half of my key verbatim, the path seems like a likely spot for an error - try it in a command line window and make sure it's right.

Anonymous said...

thanks, you rock!