Ales Rosina's blog

shelastyle.net
Subscribe

WebKit vs. IE browser control in C#



 

Recently I needed to include a web browser control (in Windows Forms project), so the logical choice would be WebControl, which is actually only .NET wrapper around Internet Explorer’s ActiveX control.

Well, I wanted to try some other engines, like WebKit (which is core of Apple Safari, Google Chrome, Adobe AIR, etc.), since IE engine (called Trident) scores on Acid3 very low (13 out of 100) and WebKit engine scores almost perfect (99 out of 100). For most cases this is not important, since most of web pages are done with optimizations for all browsers, but sometimes it is.

So for this test I’ve created very simple application, where you can compare those two rendering engines (you can download this app here, if you’re not interested in code).

I have run this app on a different sites and found out, that WebKit renders pages faster, if there is a lot of JavaScript behind, where simple plain HTML pages is rendered faster by Internet Explorer engine. So based on that, you have to decide which control to use in your application.

acid3 
For WebKit implementation I’ve used WebKit.NET, which is using Cairo derivate of WebKit (how to build it on your own, read here) and already includes binaries, so all you need to do, is to include WebKitBrowser in your toolbox in Visual Studio (right click on Toolbox > Choose items > .NET Framework Components > Browse… and select WebKitBrowser.dll from previously downloaded zip file) and drag it into your Form. Using this component is basically the same as using WebBrowser control, so you start navigation with

webBrowser1.Navigate(textBox1.Text);


and do something when document is loaded on event:

private void webBrowser1_DocumentCompleted(
object sender, WebBrowserDocumentCompletedEventArgs e) { //... }
And that’s it, you just created a very simple web browser.

You can download project (with source code) here, so you can play with code or if you want only app, download it here.
Reblog this post [with Zemanta]
Bookmark and Share
author: Aleš Rosina | Comments: 5 | Tags: , , ,
07
February
2010

 
Faheem on 23. February 2010 at 07:58

Hi tried the web kit works like a charm.

I was building an application which used google earth(geplugin)

to show the earth in a browser control in c#.net

Recently google launched chrome frame. now i am unable to load the same document as now google earth uses chrome frame to route everything through google chrome. I have added the meta tag as they insisted but still the chrome frame was unable to load... Anyways my question was...

that for the default web browser control in c#.net wrapping IE i used to use.

this.wbOnline2DMap.Document.InvokeScript("FlyHere", new string[] { this.tbMapTxtLocation.Text });

inorder to invoke an external javascript method from my app. Cant find this function in webkit bowser. Any help please urgently...

Faheem on 23. February 2010 at 08:11

hi

Need to call javascript function from c#.net

I did this in the traditional IE browser control in c#.net

this.wbOnline2DMap.Document.InvokeScript("FlyHere", new string[] { this.tbMapTxtLocation.Text });

what should i do for web kit browser control

faheem on 23. February 2010 at 08:12

sorry for the multiple posts. got some errors on my page

jeu tarot on 16. July 2010 at 02:12

It works at home, thanks ;-) Useful !!!

Adnan on 21. July 2010 at 08:12

Is there any tutorial for beginners which deals with navigation a URL to manipulating DOM or accessing Javascript?

thx

Leave a Comment

Name:
Email:
I respect your privacy, so your email is never published.
Web site: