Created
June 12, 2012 19:22
-
-
Save robcolburn/2919562 to your computer and use it in GitHub Desktop.
How to open only some urls in WebView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From @craigpfau - http://craigpfau.com/2012/02/phonegap-ios-uiwebview-and-safari-app-links/ | |
To just enable UIWebView for the single URL I used this code [projectFolder > Classes > MainViewController.m] | |
*/ | |
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType | |
{ | |
NSURL *url = request.URL; | |
if ([url.absoluteString rangeOfString:@"URLToOpenInUIWebView.com"].location != NSNotFound) { | |
return YES; | |
} | |
else { | |
return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Odd man, not sure. I'd try this.
Once you've got that working, try to figure out what's different in your app.