Set Gmail As Your Browser's Default Email Client

Sick of mailto: links in your browser opening Outlook or Mail.app whenever you click them? You can tackle this problem with extensions or through other means, but Googler and HTML5 guru Paul Irish offers a simple, no-add-ons-required approach. Here's how it works:

  1. Open Gmail in Chrome.
  2. Press Ctrl+Shift+J (Windows) or Cmd+Opt+J (Mac) to open Chrome's built-in JavaScript console.
  3. Paste the following into the console and press Enter:

    navigator.registerProtocolHandler("mailto", "https://mail.google.com/mail/?extsrc=mailto&url=%s", "Gmail");

  4. Chrome will prompt you, asking if you'd like to "Allow Gmail (mail.google.com) to open all email links?" Click the Use Gmail button.
  5. That's it!

To test that it worked, try this mailto: link, which should open a new message in Gmail with a link to Irish's post over on HTML5 Rocks.

Incidentally, this feature has been around in Firefox since Firefox 3, so Firefox users, you can accomplish the same task by following roughly the same steps. However, Firefox has also gone a step further to make this easier. Open Firefox Preferences, click the Applications tab, and type mail into the search filter. In the Action dropdown for the Content Type mailto, select Use Gmail. Easy peasy.

Getting Gmail to handle all mailto: links with registerProtocolHandler [HTML5 Rocks]


Comments

    I got a response "undefined" in the console. Chrome 16.091277

      Upgraded to 17.0.963.46 m
      - same problem

        I did too first go but then remembered that I didn't have gmail open. Works a treat now. Thanks for the tip Adam. Stoked!

        Response undefined is ok - go to your gmail tab - you'll see a security confirmation (step 4 from TFA)

          It's in gmail tab.

          There is no confirmation UI.

            Hi Mike, I'd check to see if gmail is set as an ignored protocol handler. Go to Wrench > Options > Under the Hood > Content settings... (it's a button in the Privacy section) > Manage handlers... (a button in the Handlers section). You may see a section called Ignored Protocol Handlers or something like that. If mail.google.com is listed there, remove it.

            Depending on your version of Chrome, the "Allow Gmail (mail.google.com) to open all email links?" bar may appear the next time you go to gmail. If not, try the trick from this article again.

    I followed the instructions, namely step 1. No issues here.

    Thanks for a great tip!! I've been copying and pasting email links to Gmail as I didn't know you could do this.

    Doesn't save a lot of time but makes it nicer to use all the same.

    Is there anyway to open the link in a new tab by default?

      Good question. Anyone?

    Yes, finally! I have been trying to figure out how to force this for some time ... Chrome prompted naturally for calendar, but not email. Worked fantastically. Thank you!

    is there a way to do it on the iPhone?

    This solution is NOT working for me. I keep getting an "undefined" message after pasting the code.

    I'm in the gmail tab, tried multiple times, there is no "ignored protocol handlers" section to check that I can see, even uninstalled chrome to see if it would reset.

    Nothing works. Please help.

    Chrome version: 21.0.1180.89
    Windows 7

    Doesn't work at all for me either.

    Chrome version: 21.0.1180.89
    Windows 7

    It does not work for me too on v21.0.1180.89 m. I tried reloading Gmail and closing Chrome.When I look at the handlers, I see a blank list of active handlers. Something does not look right on the settings for the handlers. I think there is an issue.

    I figured it out. Go to the Gmail tab and in the omnibox there is an icon that looks like two diamonds next to the bookmark star. Click that and it will ask if you want to use Gmail for mail links.

      YES! This fixed it!

    What if you have a personal gmail account and then your work account is linked through gmail, but with a different @ address. I would like to make my work e-mail account the main one to use?

    Thanks in advance.

Join the discussion!

Trending Stories Right Now