在新标签页/窗口中打开 href mailto 链接 [英] Open the href mailto link in new tab / window

查看:40
本文介绍了在新标签页/窗口中打开 href mailto 链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张图片,点击后我想链接到一个邮箱:

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>

然而,目前一旦点击它,它将启动电子邮件选项来选择一个mailto应用程序,一旦我选择,mailto链接就会在当前选项卡中打开.这将导致用户离开应用程序.

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.

因此,我希望发送电子邮件的页面(通过 gmail、yahoo 等)要么在新标签页中打开,要么在窗口中打开.知道如何做到这一点吗?我尝试了 target="_newtab" 和 target="_blank" 但都没有奏效.

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方法,谢谢)

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

推荐答案

mailto 调用用户默认的电子邮件客户端.它在任何情况下都不会打开窗口或选项卡.如果您想使用窗口或选项卡,您需要配置一个表单并允许该表单在您的窗口/选项卡中打开.当然,您必须将表单配置为使用服务器上可用的任何方法发送邮件.

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.

这篇关于在新标签页/窗口中打开 href mailto 链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆