Need to open link in safari from uiwebview?

ios, iphone, uiwebview

Solution

You can use following code for that.

   -(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
        if ( inType == UIWebViewNavigationTypeLinkClicked ) {
            [[UIApplication sharedApplication] openURL:[inRequest URL]];
            return NO;
        }

        return YES;
    }

Problem

I have stored my whole html document with escape sequence in a variable... and it contains some anchor tag.. where if that has clicked, it should open in safari, not in my app webview....

Original source