A Simple Web Browser in under 6 hours

May 2005

With about an hour to kill on the daily commute to work, I played with Apple's WebKit Framework, which is based on the open source Konqueror. Creating a new web browser was not my real intention, but a lot of ideas have been floating around in my head that require familiarity with WebKit. I had the help of Apple's documentation and this great article on Cocoa Dev Central.

Creating a new web browser was not my real intention, but a lot of ideas have been floating around in my head that require familiarity with WebKit. I had the help of Apple's documentation and this great article on Cocoa Dev Central.

In under 6 hours I was able to create a browser with the following functionality:

  • Basic web browsing in multiple windows
  • Back/forward history
  • URL and search bars with stored history, and
  • A customisable toolbar

That was only after a few hours going through Aaron Hillegass' book on Cocoa and playing around with XCode 2 and Interface Builder. Most of the time was actually spent figuring out how NSToolbars and NSSearchFields work in Cocoa applications. I am sure an experienced Cocoa programmer could do it in half the time.

Suffice to say, I am hooked!

In contrast, I developed a tabbed web browser using IE's API and WTL at work. Being a WTL newbie, I was able to achieve comparable functionality within a week using Microsoft's tools, which already seemed fast enough (with MFC it might have been faster).

One thing Visual C++ provides is a visual tool to create toolbars for an application. Programatically, it is dead simple to add toolbars using Cocoa and you get more bang for your buck (such as toolbar customisation), but I am surprised there is no way to create and attach one in Interface Builder. Maybe I'm just blind and can't find the right button to click and drag? :)