Search code examples
objective-cios5uiwebviewsafariuiwebviewdelegate

Open links Explicitly in Safari from a Table Detail View


All,

I have rich text, with links, in my UITableView's detail View:

enter image description here

When a link is pressed, the URL is loaded into the UIWebView where the rich text is being displayed. I'd like the URLs to open in Safari instead.

Can someone tell me how to accomplish this correctly? Is there a UIWebView delegate method suited for this purpose?

Thanks


Solution

  • // where url is an NSURL
    
    [[UIApplication sharedApplication] openURL:url];
    

    This will open the link in the default OS browser.

    Documentation here.