Skip to content

Instantly share code, notes, and snippets.

@tarappo
Created February 14, 2013 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarappo/4951343 to your computer and use it in GitHub Desktop.
Save tarappo/4951343 to your computer and use it in GitHub Desktop.
特定のURLの時はブラウザで表示。 ※事前にself.webView.delegate = self;をしておく。
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSString *checkURL = [request.URL absoluteString];
NSRange linkMatch = [checkURL rangeOfString:@"http://example.com"];
if (linkMatch.location != NSNotFound) {
[[UIApplication sharedApplication] openURL:request.URL];
return NO;
}
}
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment