开发者

Detect a mail link and when pressed, mail the address in app

开发者 https://www.devze.com 2023-04-10 06:00 出处:网络
How can I detect开发者_如何学JAVA when a mailto link is pressed in a UIWebView, and when it is pressed, open a window in the app to send the mail.you can set the webview to recognize the links as

How can I detect开发者_如何学JAVA when a mailto link is pressed in a UIWebView, and when it is pressed, open a window in the app to send the mail.


you can set the webview to recognize the links as

webView.dataDetectorTypes=UIDataDetectorTypeLink;

here is a link which will be of help I guess...

http://www.iphonedevsdk.com/forum/iphone-sdk-development/21630-open-email-editor-href-link-uiwebview.html


implement below method

- (BOOL)webView:(UIWebView *)webView1 shouldStartLoadWithRequest:(NSURLRequest *)request  navigationType:(UIWebViewNavigationType)navigationType{
    NSURL *requestURL = [request URL];  
    NSString *str_url = [requestURL absoluteString];
    if([str_url isEqualToString:@"about:blank"]){
        return YES;
    } else {
        //you can write  mailComposeController methods over here
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号