Get URL that User tap in UIWebView
- (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"]) {
NSLog(@"user tap: %@", [URL absoluteString]);
[[UIApplication sharedApplication] openURL:URL];
}
return NO;
}
return YES;
}
Labels:
iphone SDK,
link,
url,
webview