Skip to content

Browser Tutorial #1: Creating a Simple Web Browser in RubyCocoa

The Webkit framework has made it ridiculously easy to create a browser as part of any OS X application and there are tutorials all over the web to show how this can be done in Cocoa applications. For the basics, it doesn’t require any code at all, so it comes as no surprise that this as easy in RubyCocoa applications as in other languages.

In the first of several tutorials (only some of which will be screencasts), I will show the basics of creating an extremely simple browser and then we’ll move on to add some Ruby code and other features in later episodes.

For a more advanced XCode project to play with that incorporates more features than we will get to in these tutorials, feel free to dive into the example that comes with RubyCocoa, which is located in the /Developer/Examples/RubyCocoa/MiniBrowser folder.

RubyCocoa Webkit Tutorial #1

RubyCocoa Webkit Tutorial XCode Project

Tutorial #1 Summary

In the first screencast I will go through the following simple steps:

1. Add controls for the browser, including the WebViewer control.
2. Connect these controls to Webkit methods associated with the WebViewer
3. Fix autosizing for the address field and the WebView browser component.
4. Add the Webkit framework to the Linked Frameworks folder.
5. Activate the “New” file menu item.

UPDATE: jp_tix on #ruby-osx kindly pointed out that you don’t have to change a Custom View into a WebView in Interface Builder, but can drag a WebView directly from the Library. I didn’t notice the availability of this control. Thanks! You can find this in the library and it looks like this:

Interface BuilderScreenSnapz002.jpg

2 Comments

  1. E. Colon wrote:

    As an amateur programmer myself, this site has become a valuable resource for all things ruby and cocoa. Keep up the good work!

    Thursday, June 26, 2008 at 1:14 pm | Permalink
  2. K. M. Lawson wrote:

    Thanks, I will try to post when I can!

    Thursday, June 26, 2008 at 7:53 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*