If App has an Web View and web view has some link and we want to identify the click event and open the link in safari or open mail window, then follow as below code.
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
//CAPTURE USER LINK-CLICK.
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *URL = [request URL];
if ([[URL scheme] isEqualToString:@"http"]) {
[[UIApplication sharedApplication] openURL:URL];
return NO;
}
else if ([[URL scheme] isEqualToString:@"mailto"]) {
[[UIApplication sharedApplication] openURL:URL];
return NO;
}
}
return YES;
}