从应用程序内的网页在 iPhone 上打开 Mail.app

发布于 2024-10-19 04:16:21 字数 586 浏览 1 评论 0原文

我们的应用程序从应用程序内部的网站加载个人资料页面。它们已经针对 iPhone css 进行了优化,但它们仍然是 html 页面。我们的 mailto 链接未按预期工作。 单击时,没有任何反应。但是,当单击并按住(点击并按住)时,菜单会向上滑动,显示“新消息”、“创建新联系人”、“复制”等。

应如何格式化此格式以使 Mail.app 自动启动?

<a class="action_bubble" target="_blank" rel="external" href="mailto:[email protected]">Send Email</a>

“调用”链接按预期工作。

<a class="action_bubble" href="tel:1234567890">Call</a>

所以,不知道该怎么办......

our app loads profile pages from our website INSIDE the app. They have been optimized for iPhone css, but they are still an html page. Our mailto link isnt working as expected.
When clicked, nothing happens. However, when clicked and held (tap and hold), the menu slides up with "new message", "create new contact", "copy", etc.

How should this be formatted to get the Mail.app to automatically launch?

<a class="action_bubble" target="_blank" rel="external" href="mailto:[email protected]">Send Email</a>

The "call" link works as expected.

<a class="action_bubble" href="tel:1234567890">Call</a>

So, not sure what to do with this...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

彼岸花似海 2024-10-26 04:16:21

这是解决您的问题的 GitHub 上的项目。基本上,当您使用 UIWebView 控制器时,您需要决定如何使用 UIWebView 的委托处理程序来管理链接。在 Interface Builder 中,您可以让它自动识别电话号码,这可能就是您的电话号码起作用的原因,并且它会将 http 链接识别为默认行为。但是,mailto 和其他一些特殊的 href 选项需要手动处理。

Here is a project on GitHub that addresses your issue. Basically, when you use a UIWebView controller, you need to decide how to manage the links using the delegate handler for UIWebView. In Interface Builder you can have it automatically recognize phone numbers which is probably why your phone numbers work and it will recognize http links as default behavior. However, mailto and some of the other special href options will need to be handled manually.

江挽川 2024-10-26 04:16:21

确保为您的 UIWebView 设置“检测”属性,例如“电话”、“地址”。您可以从您的 IB 进行设置。

或来自代码

self.webView.dataDetectorTypes = UIDataDetectorTypeAll;

make sure "Detection" property is set for your UIWebView like "Phone","Address". you can set it from your IB.

or from code

self.webView.dataDetectorTypes = UIDataDetectorTypeAll;

蓝咒 2024-10-26 04:16:21

难道你刚刚在模拟器中尝试过?模拟器没有邮件应用程序,所以无法打开。在设备上尝试。我认为你的代码确实有效。

我刚刚在设备上进行了测试:您的代码可以工作。

Could it be, that you have just tried within the simulator? The simulator does not have a mail app, so it couldn't be opened. Try on a device. I think your code actually works.

I've just tested on a device: your code works.

白鸥掠海 2024-10-26 04:16:21

聚会有点晚了,但我发现了以下内容:

  1. iOS 有一些奇怪的方式来处理网页内容
  2. 不要将您的电子邮件地址封装在 A 标签中,只需将其以纯文本形式放在那儿
  3. 确保在故事板中(如果使用的话)webView 已检查了 Addresses 属性,您就完成了...电话号码也是如此

A little late to the party but I've found out the following:

  1. iOS has some weird ways to deal with web content
  2. DON'T encapsulate your email address within an A tag, just put it there as plain text
  3. Make sure that in your storyboard (if using one) the webView has the Addresses property checked and you're done ... same goes for phone numbers
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文