Skip to content

Instantly share code, notes, and snippets.

@RandyMcMillan
Created May 20, 2012 16:18
Show Gist options
  • Save RandyMcMillan/2758655 to your computer and use it in GitHub Desktop.
Save RandyMcMillan/2758655 to your computer and use it in GitHub Desktop.
MainViewController.m (openInSafari) switch
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
{
NSURL *requestURL =[ [ request URL ] retain ];
if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL scheme ] isEqualToString: @"https" ] || [ [ requestURL scheme ] isEqualToString: @"mailto" ])
&& ( /*navigationType == UIWebViewNavigationTypeLinkClicked ||*/ navigationType == UIWebViewNavigationTypeOther ) ) {
return ![ [ UIApplication sharedApplication ] openURL: [ requestURL autorelease ] ];
}
[ requestURL release ];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment