I have a very simple UIWebView with content from my application bundle. I would like any links in the web view to open in Safari instead of in the web view. Is this possible?
+8
A:
Add this to the UIWebView delegate:
-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}
drawnonward
2010-05-24 19:47:32
A:
One quick comment to user306253's answer: caution with this, when you try to load something in the UIWebView yourself (i.e. even from the code), this method will prevent it to happened.
Mathieu Godart
2010-10-07 16:19:15