Reputation: 1934
How can I detect when a mailto link is pressed in a UIWebView
, and when it is pressed, open a window in the app to send the mail.
Upvotes: 1
Views: 2323
Reputation: 6323
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
}
}
Upvotes: 1
Reputation: 12405
you can set the webview to recognize the links as
webView.dataDetectorTypes=UIDataDetectorTypeLink;
here is a link which will be of help I guess...
Upvotes: 1