diff options
author | Struan Donald <struan@exo.org.uk> | 2012-03-14 22:57:32 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-03-14 22:57:32 +0000 |
commit | 9a84aaa3cd29804601c800da4f7a8a77827aa220 (patch) | |
tree | df9ba935503e4715d31ed3b5d82db2a7bd87e174 | |
parent | 91859b4f7df490001df3a54067fc01929cb0490f (diff) |
open links beginning with http in safari and not our webview
-rw-r--r-- | phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m b/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m index 8faa38ca6..6a7defb8c 100644 --- a/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m +++ b/phonegap/iPhone/FixMyStreet/Classes/AppDelegate.m @@ -180,7 +180,17 @@ - (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { - return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; + NSURL *url = [request URL]; + + // Intercept the external http requests and forward to Safari.app + // Otherwise forward to the PhoneGap WebView + if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) { + [[UIApplication sharedApplication] openURL:url]; + return NO; + } + else { + return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; + } } - (void) dealloc |