Mailto links do nothing in Chrome but work in Firefox?

后端 未结 17 565
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 08:13

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://j

相关标签:
17条回答
  • 2020-12-02 08:51

    I solved the problem using this code:

        
    <button onclick="email()">Contact me !</button>	
    
    <script>
    function email() {
        var str = window.open('mailto:aaaaaa@aaaaaa.net', '_blank');
    }
    </script>

    It worked for me like a charm !

    0 讨论(0)
  • 2020-12-02 08:52

    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.

    0 讨论(0)
  • 2020-12-02 08:53

    Please check it this:

    This is working in chrome and all browser.

    <a href="mailto:test.test@gmail.com">Test</a>
    

    try and working in great.

    0 讨论(0)
  • 2020-12-02 08:54

    The usual <a href="mailto:hi@hi.com"></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.

    0 讨论(0)
  • 2020-12-02 08:55

    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.

    0 讨论(0)
提交回复
热议问题