Crashalot
Crashalot

Reputation: 34503

Mailto links do nothing in Chrome but work in Firefox?

It seems like the mailto links we're embedding in our website fail to do anything in Chrome, though they work in Firefox.

Simple example here: http://jsfiddle.net/wAPNH/

<a href='mailto:[email protected]'>hi this is a test</a>

Do we need to do something special to enable mail links in Chrome?

Upvotes: 187

Views: 285383

Answers (19)

Chris
Chris

Reputation: 644

I had trouble with all of the listed solutions. I ended up heading to Gmail and running:

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

Upvotes: 0

MrPatel2021
MrPatel2021

Reputation: 211

I face same issue. because I am working in google chrome and my default app is also google chrome. So, google chrome is not able to open another chrome. So, we need to just change our default app.

You need to update default app settings.

  • search default apps.
  • Email
  • choose an app as a default app.

Upvotes: 0

Sambarilove
Sambarilove

Reputation: 123

I just had the same issue. Creating a function solved the problem:

<script>
    function sendEmail(){        
        window.location = "mailto:[email protected]";
    }
</script>

<a onclick="sendEmail();">hi this is a test</a>

Upvotes: 0

Dr. Waleed Aldhahi
Dr. Waleed Aldhahi

Reputation: 377

I solved the problem using this code:

    
<button onclick="email()">Contact me !</button>	

<script>
function email() {
    var str = window.open('mailto:[email protected]', '_blank');
}
</script>

It worked for me like a charm !

Upvotes: 1

kennypu
kennypu

Reputation: 6051

This is browser settings specific, i.e. it will behave differently depending on the user's browser settings. The user can change how mailto: links behave in chrome by visiting chrome://settings/handlers, or Chrome Settings->Content Settings->Manage Handlers...

If "email" is not listed on that page, then see this answer regarding how to proceed.

Upvotes: 171

Rajesh Hegde
Rajesh Hegde

Reputation: 2812

This is because chrome handles the mailto in different way. You can go to chrome://settings/handlers and make sure that which is the default handler. In your case it will be none (i.e. not listed). Now go to gmail.com. You should see something like this when you click on the button beside the bookmark button.

Set mailto in chrome

If you wish to open all email links through gmail then set "Use Gmail". Now when you click on mailto button, chrome will automatically opens in gmail.

Upvotes: 141

user11768920
user11768920

Reputation:

'Use Chrome, invite troubles' - Anonymous. (Just a symbolic reference)

Well, Chrome is notoriously famous for a lot of default security-enabled utilities, and that's where your problem originates from.

This can, however, be undone by 'setting the default email client' (as the default email client is unset), or by setting up the default handler under 'chrome://settings/handlers' (by default, it's set to 'Ignore').

Upvotes: 0

CodeBrauer
CodeBrauer

Reputation: 2925

On macOS check also the Mail.app settings, which App is selected as default email App / associated with mailto: links:

If you ever clicked that notification on Gmail, which allows to open links in Gmail instead your App - and after this reset the Chrome handler, you have to edit this manually in your Mail.app Settings.

Screenshot

Upvotes: 6

rrudland
rrudland

Reputation: 420

I also experienced this issue, and eventually tracked it down to the fact that my link was within an iframe, and my web app uses https. Chrome was blocking it due to this (Chrome would open other mailto links outside of the iframe).

In mailto link not working within a frame chrome (over https), kendsnyder mentioned simply changing

<a href="mailto:...">email</a>

to

<a target="_top" href="mailto:...">email</a>

Voila, problem solved. That mailto link now works in all browsers.

Upvotes: 17

Sheshank S.
Sheshank S.

Reputation: 3278

The usual <a href="mailto:[email protected]"></a> should work, but remember you must have a default email program set on your computer. For ex, I'm using Ubuntu 14.04 and the default email is thunderbird, which works fine.

Upvotes: 0

red-o-alf
red-o-alf

Reputation: 3225

You need to allow gmail to install the service handler for mailto protocol:

1) go to gmail

2) click the small rhombus icon at the end of address bar (screenshot)

3) enjoy

enter image description here

Upvotes: 28

Benn
Benn

Reputation: 5013

Fix that worked for me since my Protocol handlers was empty

https://productforums.google.com/forum/#!topic/gmail/CQMCGRvyhCM

See redfish43 reply , to sum up

For mailto: - Make sure you are logged in to Gmail and the active window is your main Gmail page (or nothing will happen). - Copy/paste this into the address bar:

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

Add the javascript: to the front again if needed, because when you pasted it, Chrome probably trimmed everything before and including the colon. Then hit enter.

When popup window opens click on "Allow"

Upvotes: 11

SamJackSon
SamJackSon

Reputation: 1111

In my case, chrome was associated as MAILTO protocol in Windows 10.

I changed the association to Outlook using "Default Programs" -> "Associate a file type or protocol with a program".

MAILTO is way below in the list. This screenshot may help.

enter image description here

Upvotes: 47

Jes
Jes

Reputation: 31

I had the same problem. The problem, by some strange reason Chrome turned himself as the default tool to open a mailto: link. The solution, put your mail client as the default app to open it. How to : http://windows.microsoft.com/en-nz/windows/change-default-programs#1TC=windows-7

Good luck

Upvotes: 3

Mach1
Mach1

Reputation: 21

I found this answer on a Google forum that has worked me. In the footnotes it mentions 'googleapps.exe' - I don't have this and it has still worked. Simply follow the instructions below but close down all applications before making changes to the Registry. Also I saved the existing value just in case it didn't work.


Simply type "run" in your search bar, then type "regedit" then travel to:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command\ 

edit (double click) "(Default)" to:

"C:\Program Files (x86)\Google\Google Apps\googleapps.exe" --domain= --mailto.google.com="%1" 

That's it! Save and close it and it should work beautifully!

Using this method prevents you from having to download the GMail Notifier, which for those of us with GTalk don't need since it does it for us. I'm not sure why Google can't solve this issue easily.. i've heard Google Apps haven't been tested fully on Windows 7 but it's obvious the same tag works with it.

Note: The only thing with this solution is you need to have the googleapps.exe file on your machine. I believe I got it with my free GooglePack from their site which has now been discontinued. I tried searching the net for a way to download it but weirdly enough it seems it's reserved only for Businesses now and there is no download link available from the web because everyone who has it streamed it using the google updater.. Odd. Anyway good luck!

Upvotes: 2

Hiren Purohit
Hiren Purohit

Reputation: 1

You can use like this also,

<a href="javascript:void(0);" onclick="javascript:window.location.href='mailto:[email protected]'; return false;">[email protected]</a>

I think this is best way to resolved for chrome issues.

Thanks..

Upvotes: -3

Bharat Parmar
Bharat Parmar

Reputation: 154

Please check it this:

This is working in chrome and all browser.

<a href="mailto:[email protected]">Test</a>

try and working in great.

Upvotes: -7

fenix
fenix

Reputation: 164

Another solution is to implement your own custom popup/form/user control that will be universally interpreted across all browsers.

Granted this will not leverage the "mailto" out of the box capabilities. It all depends on what availability adherence you are working against. Unfortunately for myself - the mailto needed to be available to everyone by default without "inconveniencing the client".

Your decision ultimately.

Upvotes: 1

suff trek
suff trek

Reputation: 39767

You can try going to chrome://settings/handlers and set value for mailto: to none instead of gmail

Upvotes: 7

Related Questions