Hi everyone..
I have a webpage in uiwebview.. On this page are a couple of http:// links. One of them I want to have it opened in safari. The rest can open in UIWebview. I used this code so far;
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
{
NSURL *requestURL = [ [ request URL ] retain ];
// Check to see what protocol/scheme the requested URL is.
if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ]
|| [ [ requestURL scheme ] isEqualToString: @"https" ] )
&& ( navigationType == UIWebViewNavigationTypeLinkClicked ) ) {
return ![ [ UIApplication sharedApplication ] openURL: [ requestURL autorelease ] ];
}
// Auto release
[ requestURL release ];
// If request url is something other than http or https it will open
// in UIWebView. You could also check for the other following
// protocols: tel, mailto and sms
return YES;
}
This works fine for the http and https etc. My idea was to make ONE of the links of the website point to safari://blah.com and change the above code to;
if ( ( [ [ requestURL scheme ] isEqualToString: @"safari" ]
|| [ [ requestURL scheme ] isEqualToString: @"https" ] )
Hoping this would open the safari:// url in safari and the rest in UIWebview. But no luck. It seems like only the standard stuff (like http https tel mailto and sms) work here. Any ideas how to get around this?