Extend UIWebView to handle all special links

Have you ever wanted to add an UIWebView to your application, so you can browse the internets without leaving your application? While it is a trivial task to add an UIWebView to a project, there are some links that an UIWebView will not handle.

These are:

  • mailto
  • YouTube
  • maps.google.com
  • iTunes
  • AppStore

I’ve written a generic BrowserViewController, code available on GitHub here: http://github.com/sburlot/browserviewcontroller which handles all these cases:

mailto links are handled with a MFMail: I tried to handle all variations on the link: “to”, “cc”, “subject” and “body”.

YouTube, Map, iTunes and AppStore links are opened in their respective apps.

You can customise the view and decide if you want a navigation tab bar or not.

The navigation tab bar will add standard web buttons: Back, Forward, Stop, Reload and also a button to send the url of the current page via email, or open it in Safari.


One comment on “Extend UIWebView to handle all special links

  1. nathan

    As someone who’s just getting into objective-c and handling UIWebviews, your class will be a great help, at the least as a good coding reference. I may be back with questions though, watch out!

Leave a Reply

Your email address will not be published. Required fields are marked *