I have an UIWebView containing links. These links should open in another view inside my app, except links containing "mailto". To achieve this, I'm using the following code inside the UIWebViews delegate:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if (navigationType == UIWebViewNavigationTypeLinkClicked)
{
NSRange mailPos = [[[request URL] absoluteString] rangeOfString:@"mailto:"];
if (mailPos.location == NSNotFound)
{
self.parent.browserView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.parent.setupViewC presentModalViewController:self.parent.browserView animated:TRUE];
[self.parent.browserView.wvMainView loadRequest:request];
}
else [[UIApplication sharedApplication] openURL:request.URL];
return FALSE;
}
return TRUE;
}
This works fine in the simulator and on the iPhone - but it doesn't work at all on iPods. Clicking on a link just doesn't do anything on an iPod Touch.
Calling
[self.parent.browserView.wvMainView loadRequest:request];
after a click on an UIButton does work however. So is there any way to make the links inside the UIWebView work on an iPod too?