Mono WebBrowser with WebKit [Gtk# not WinForms]

For long time I have looking for displayin web pages on Mono by using Gtk#…And thanks to this post I came across with WebKit solution!


WebKit is as they define in their page:

WebKit is an open source web browser engine. WebKit is also the name of the Mac OS X system framework version of the engine that’s used by Safari, Dashboard, Mail, and many other OS X applications. WebKit’s HTML and JavaScript code began as a branch of the KHTML and KJS libraries from KDE. This website is also the home of S60‘s S60 WebKit development.

Well after looking to the simple solution that is made in, I give a try to my solution and here it is:

<pre>using System;
using Gtk;
using WebKit;

namespace browserapp {
 class browser {

 public static void Main () {
 Application.Init ();
 Window window = new Window ("BROWSER");
<div id=":h0">
 window.Destroyed += delegate (object sender, EventArgs e) {
 Application.Quit ();
 ScrolledWindow scrollWindow = new ScrolledWindow ();
 WebView webView = new WebView ();
 webView.Open ("");
 scrollWindow.Add (webView);</pre>
 Label name=new Label();
 Fixed fixed1=new Fixed();
 window.Add (fixed1);
 window.ShowAll ();
 Application.Run ();


In my Debian Lenny:

“apt-get install mono-2.0-devel gtk-sharp2 libwebkit1.0-cil”

“gmcs -pkg:gtk-sharp-2.0 -pkg:webkit-sharp-1.0 web.cs”

“mono web.exe”

The Ouput:


kick it on