Posts Tagged ‘webkit’

Writing a browser in three rows

Saturday, February 14th, 2009

We reached a new record: writing a browser in three rows! After python I decided to test also WebKit bindings for ruby:

[kaltura-widget wid="jr0a2p7nrk" width="410" height="364" addpermission="0" editpermission="3" /]

And these are the three rows:

  1. require 'webkit'
  2. Gtk::Window.new().add(wv = Gtk::WebKit::WebView.new).show_all
  3. Thread.new do Gtk.main end

As you can see from the video to open a webpage you have to write wv.open(“URL”) to the irb prompt.

Writing a browser in less than a minute

Saturday, February 14th, 2009

I wanted just to test WebKit, but instead of getting a browser based on that project I decided to test directly the (gtk) widget using python and I was impressed how it is simple and fast embedding a full functional web browser in any kind of application!

[kaltura-widget wid="vzjollzqgu" width="410" height="364" addpermission="0" editpermission="0" /]

The source used in this video is (almost):

  1. import webkit
  2. import gtk
  3.  
  4. wv = webkit.WebView()
  5. w = gtk.Window()
  6. w.add(wv)
  7. w.show_all()
  8. wv.open("http://cjg.cruxppc.org")
  9. gtk.main()

If you can’t/wan’t use any flash player you can download and watch the video from: Writing a browser in less than a minute.