example.m
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
// クリックしたリンクのURLを取得
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSString *pattern = @"http://hoge.jp/";
NSString *url = [NSString stringWithFormat:@"%@",[request URL]]; // [request URL]でクリック先のURLが取得できる
if ([url hasPrefix:pattern]) {
[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}
}