Open the href mailto link in new tab / window

2020-01-31 01:37发布

I have an image which when click, I want to link to a mailto:

 <a id="mailto" href="mailto:hfms@live.com.my" target="_newtab" >
        <img src="@Url.Content("~/Content/HomePage/email.png")" alt="email" /></a>

However, currently once its clicked, it will launch the email option to choose a mailto application, and once i choose, the mailto link is open in the current tab. This will cause user to leave the application.

So, I want the page to sent email (by gmail, yahoo, etc ) is either open in new tab or in a window. Any idea how to do this? I tried both target="_newtab" and target="_blank" but both didn't work.

Any help will be much appreciated.. Thanks...

(jQuery method is also acceptable if there is no other way, thanks)

8条回答
祖国的老花朵
2楼-- · 2020-01-31 01:55

mailto calls the users default email client. It does not open a window or tab in any instance. If you want to use a window or tab you need to configure a form and allow the form to open in your window/tab. Of course, you'll have to configure the form to send mail with whatever method is available on your server.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-01-31 01:59

this information is outdated, now it is possible to do so i believe, since gmail and others now work via browser links. there is however the problem that you would only want it to open in a new tab if NOT opening in a system mail client, and open in a new tab if it is a webmail client, otherwise for example Outlook users see a blank tab appear, which is disorienting, especially since they are Outlook users.

查看更多
登录 后发表回答