aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-03-14 22:57:32 +0000
committerStruan Donald <struan@exo.org.uk>2012-03-14 22:57:32 +0000
commitcd2c858de97db51988ebc500dd052ca39e71b956 (patch)
treeb66b0eed418e40360cbae1ccef2bbaa87067c2d9
parent635fa32544668840624614f3a3f5bb6c011ad5c6 (diff)
open links beginning with http in safari and not our webview
-rw-r--r--iPhone/FixMyStreet/Classes/AppDelegate.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/iPhone/FixMyStreet/Classes/AppDelegate.m b/iPhone/FixMyStreet/Classes/AppDelegate.m
index 8faa38c..6a7defb 100644
--- a/iPhone/FixMyStreet/Classes/AppDelegate.m
+++ b/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