views:

7223

answers:

5

Is there any relatively easy way to insert a modern browser into a .NET application?

As far as I understand, the WebBrowser control is a wrapper for IE, which wouldn't be a problem except that it looks like it is a very old version of IE, with all that entails in terms of CSS screw-ups, potential security risks (if the rendering engine wasn't patched, can I really expect the zillion buffer overflow problems to be fixed?), and other issues.

I am using Visual Studio C# (express edition - does it make any difference here?)

I would like to integrate a good web browser in my applications. In some, I just use it to handle the user registration process, interface with some of my website's features and other things of that order, but I have another application in mind that will require more err... control.

I need:

  • A browser that can integrate inside a window of my application (not a separate window)
  • A good support for CSS, js and other web technologies, on par with any modern browser
  • Basic browser functions like "navigate", "back", "reload"...
  • Liberal access to the page code and output.

I was thinking about Chrome, since it comes under the BSD license, but I would be just as happy with a recent version of IE.

As much as possible, I would like to keep things simple. The best would be if one could patch the existing WebBrowser control, which does already about 70% of what I need, but I don't think that's possible.

I have found an activeX control for Mozilla (http://www.iol.ie/~locka/mozilla/control.htm) but it looks like it's an old version, so it's not necessarily an improvement.

I am open to suggestions

+12  A: 

Chrome uses Webkit if you didn't know, which is also used by Safari. Here's a few questions that are of the same vein:

The webkit one isn't great as the answer above says, one no longer works (the google code one) and the Mono one is experimental. It'd be nice if someone made the effort to make a decent .NET wrapper for it but it's not something anyone seems to want to do - which is surprising given it now has support for HTML5 and so many other features that the IE engine lacks.

Chris S
Thanks. I will have a look at the Gecko wrapper. One thing though, the original answer says "All you need to do is register the Mozilla ActiveX control" and I thought that the Express editions couldn't register additional controls. Am I missing something obvious?
Sylverdrag
@Syl the express editions can register as many controls as you need. What they won't do is let you install plugins to visual studio.
Joel Coehoorn
+4  A: 

Have look at the Mono.WebBrowser control - it embeds either Gecko (as used by Firefox) or WebKit (as used by Safari) into WinForms (without using ActiveX).

RichieHindle
+2  A: 

Checkout the GeckoFX control.

A: 

Hi, I wonder if someone can help me with a problem Ive been trying to make a load simulator, but i'm running into some issues, to make a long story short, i need a webbrowser component that fills these requirements: 1.must suport proxy settings on a component basis (note that they will be imlemented in separat threads if this helps)

2.must suport postdata editing before the request is sent

3.must triger the download of media and all necessary content of the page (however a visual rendering is not mandatory)

Ive already tried using the HttpWebRequest class, the Windows.Forms.WebBrowser component and the SHDocVw.axWebBrowser but i just cant get the to satisfy all the parameters above. (for some more details see here http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/8a6f649f-99f3-4e54-a383-3160f4a57a6f)

So, my question is if there is any othere component out there witch i can download and use in my C# project witch will satisfy all the requirements above? (or any source code from a webbrowser component witch i can modify to suite my needs?)

Id really apreciate some help since ive been stuck on this for weeks

VikFreeze
Wrong place, buddy. Ask a new question instead of responding to an existing one. :)
Helgi Hrafn Gunnarsson
A: 

I have used GeckoFX and it serves me very well. It uses the Firefox engine. The only caveat I have ever run into with it, is that it emits the "DocumentLoaded" event once before the document is actually fully loaded... I think it shoots out one when the HTML is loaded, and then another one when all the images and stuff are loaded. I've fixed it by simply ignoring the first one, and it has worked beautifully without fail so far.

You can find it here: http://geckofx.org/

Like most decent libraries, it is open-source.

Helgi Hrafn Gunnarsson