简体   繁体   中英

Is there a way to tell if an end user will be able to handle <a href=“mailto:###”> links?

我正在尝试适应用户未安装电子邮件客户端的情况(例如在我的情况下:我使用Opera的内部邮件客户端,因此,如果我单击mailto:链接,则Internet Explorer不会显示任何内容。) )

At the moment it is not possible. The closest thing to an answer I ended up with this:

<a id="mail-link" href="mailto:the@email.it" onclick="if (this.hasAttribute('data-clickedonce')) {this.setAttribute('href','mailform.php?to=the@email.it');} this.setAttribute('data-clickedonce','yes');">Send a Mail</a>

The script embedded in the a tag changes the href on the second press. The theory is: if the user has no way to handle the mail protocol, nothing happens and he/she will certainly try to click the link another time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM