href mailto和iOS野生动物园 [英] href mailto and iOS safari

查看:107
本文介绍了href mailto和iOS野生动物园的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 html 上尝试一个常规的 mailto 元素时,我注意到一个人需要在 iPhone Safari 中不断按下链接才能被提示发送消息.如上一个问题中所建议,尝试添加target ="_ blank",如下所示:< a href ="mailto:foo@bar.com" target ="_ blank"> Hi</a>

Upon trying a regular mailto element on my html, I noticed that one needs to keep pressing the link in iPhone Safari to be prompted to send a message. As suggested in a previous question, I tried adding target="_blank", as follows: <a href="mailto:foo@bar.com" target="_blank">Hi</a>

这解决了iPhone上的问题(单击即可打开电子邮件草稿).但是,使用台式机时,这会在Chrome中打开空白页面.有没有一种方法可以保留Iphone的一键单击功能,而无需从桌面打开空白页?

This solves the issue on iPhone (one click opens an email draft). However, this leaves a blank page open in Chrome when using desktop. It there a way to keep the single-click-draft functionality for Iphone without otherwise opening a blank page from desktop?

推荐答案

您尝试使用< form action ="" 元素来处理而不是简单地使用锚元素mailto 网址?传统上,这是用于组织/收集数据以发送到服务器端的,但我发现为了兼容性起见,将使用量扁平化是有用的.

Instead of simply using an anchor element have you tried using the <form action=""> element to handle the mailto URL? While this is traditionally used to organize/collect data to send server-side, I've found it's useful to flatten usage for compatibility sake.

    <form action="mailto:foo@bar.com" method="get">
      <button style="background:none; border:none;" type="submit">Hi</button>
    </form>

这篇关于href mailto和iOS野生动物园的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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