Install monodevelop and the mono.webkit (aka webkit-sharp)
sudo apt-get install gtk-sharp2 libwebkit1.1-cil monodevelop
start monodevelop new gtk c# project (copy paste the code from above to match your app main class and namespace my are: coolbrowser,monobrowser)
But i didn't found in the list of installed assemblies
so i use my rusty admin skills and install from git and from webkit-sharp source
git clone https://github.com/mono/webkit-sharp.git
it didn't found the webkit dev libs and the mcs so
sudo apt-get install libwebkit-cil-dev libwebkit-dev
sudo ln -s /usr/bin/gmcs /usr/bin/mcs
./autogen.sh --prefix=/usr
sudo make install
add webkit references to the project
here is the code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Gtk; | |
using WebKit; | |
namespace monobrowser { | |
class coolbrowser { | |
public static void Main () { | |
Application.Init (); | |
Window window = new Window ("a browser in 13 lines..."); | |
window.SetDefaultSize(800,600); | |
window.Destroyed += delegate (object sender, EventArgs e) { | |
Application.Quit (); | |
}; | |
ScrolledWindow scrollWindow = new ScrolledWindow (); | |
WebView webView = new WebView (); | |
webView.Open ("http://mono-project.com"); | |
scrollWindow.Add (webView); | |
window.Add (scrollWindow); | |
window.ShowAll (); | |
Application.Run (); | |
} | |
} | |
} |
I have added the default size to be 800x600
3 comments:
Hi, I've been trying to follow your instructions and got a error while trying to build webkit-sharp:
error CS2001: Source file `generated/*.cs' could not be found
I have no idea how to fix it, can you please share a webkit-sharp.dll file somehow? Thanks.
Hi,
I also wrote an applicationwith the webkit, But now I want to display a horizontal or a vertical scrollbar when the window is resized. How can i do that?
Thanks from Colombia, very useful!!
Post a Comment