从应用程序内的网页在 iPhone 上打开 Mail.app
我们的应用程序从应用程序内部的网站加载个人资料页面。它们已经针对 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是解决您的问题的 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 specialhref
options will need to be handled manually.确保为您的 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;
难道你刚刚在模拟器中尝试过?模拟器没有邮件应用程序,所以无法打开。在设备上尝试。我认为你的代码确实有效。
我刚刚在设备上进行了测试:您的代码可以工作。
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.
聚会有点晚了,但我发现了以下内容:
A little late to the party but I've found out the following: