mailto:UIWebView中的链接 - 不起作用 [英] mailto: link in UIWebView - Does Not work

查看:132
本文介绍了mailto:UIWebView中的链接 - 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你需要在UIWebView中使用html或Callbacks来处理带有href的锚标签吗?或者href中有一个带有mailto链接的锚标记有什么特别之处吗?

Is the areanything special you need in html or Callbacks in a UIWebView to handle anchor tags with an href, or is there something special about an anchor tag with a mailto link in the href?

推荐答案

在UIWebView的委托中,执行:

In your UIWebView's delegate, do:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    if ([[[request URL] scheme] isEqual:@"mailto"]) {
        [[UIApplication sharedApplication] openURL:[request URL]];
        return NO;
    }
    return YES;
}

这篇关于mailto:UIWebView中的链接 - 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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