Is it possible to Embed Gecko or Webkit in a Windows Form just like a WebView?

落爺英雄遲暮 提交于 2019-11-26 23:38:24

http://code.google.com/p/geckofx/

This is a nice .NET-wrapped version of Gecko

It certainly is possible. All you need to do is register the Mozilla ActiveX control (mozctlx.dll I believe), and you can drag it onto your form as any ActiveX control. The programming interface is similar (though not identical) to the IE one, and you can even use the Microsoft.MSHTML.dll managed library for control in some cases.

I believe this is packaged with Firefox. If not, you can get just the embeddable bits from Mozilla as well. Just do a Google search for Mozilla ActiveX control or Mozilla Embedding C# and that should take you down the right path.

GeckoFX is no longer being updated. The alternative is the MozNet XulRunner wrapper by Se7en Soft. MozNet has a ton of features that GeckoFX doesn't and is being actively updated and maintained.

Scott

I'd just like to point out, to all looking to embed Gecko into their applications, that the GeckoFX project appears to have been abandoned by its creators (Skybound Software). MozNET, while previously based on GeckoFX, sorta' picked up the ball and ran with it. It has the full ability to print, do print previews and allows you to set it all up via the native Windows print dialog, even - and a whole lot more.

George

OpenWebKitSharp is a wrapper arount the WebKit engine (nightly) and is very advanced. Take a look at here (OpenWebKitSharp section): http://code.google.com/p/open-webkit-sharp/

Update 2016:

BrowseEmAll.Gecko

A .Net component which can be used to integrate the Firefox engine into your .Net application. This is based on Geckofx but unlike the current version of Geckofx this will work with a normal release build of Firefox. To use Geckofx you will need to build Firefox yourself. Again commercial support is available but the component itself is fully open source.

(Full disclosure: I work for this company so take everything I say with a grain of salt)

@Martin: Yes, the Adam Locke version is outdated. But that's because a separate distribution is not necessary. It's built with the rest of the Mozilla codebase now.

If you download Prism (ie XulRunner), that will give you a base that you can customize to your needs, and this includes the most recent version of the control (in the \Prism\xulrunner directory, you'll find mozctlx.dll).

@Greg: Actually, it is an ActiveX control. Incidentally, all ActiveX controls are COM controls. ActiveX is built on COM.

John Hatton

As of October 30, 2011, there is new information to add since the time of the previous posts. Specifically, while Skybound stopped maintaining their version, there is at least one actively maintained, free, open-source fork available.

I'm using Hindle's fork at BitBucket, which, by virtue of his tool which parses XpCom idls and creates c# wrappers, is rapidly updated with support for each new version of Firefox/Gecko.

See this post for an overview of other choices.

Additionally, if you find yourself using Gtk instead of Windows.Forms, there is a tarball of webkit-sharp available that allows for easy embedding of WebViews into Gtk# applications.

I Belive "Gecko FX"[1] is the thing you need.

To Quote from the web site

""" GeckoFX is a Windows Forms control written in clean, commented C# that embeds the Mozilla Gecko browser control in any Windows Forms Application. It also contains a simple class model providing access to the HTML and CSS DOM. """

1) I can't post a link as "new users aren't allowed to add hyperlinks" Search for "geckofx" on google code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!