How to embed a browser object, other than IE<n>, in a Delphi application

心不动则不痛 提交于 2019-11-27 17:20:41

TWebBrowser is IE. It is not a plugable construction for browsers. You can have other browsers integrated in your application. See

A viable alternative is CEF - Chromium Embedded Framework which encapsulates the Chromium browser which by itself encapsulates WebKit. This library is provided as plain DLLs with an exported C API.

There's a delphi interface available at code.google.com/p/delphichromiumembedded

I've been using it with my own interface implementation and works great, though not so easy to properly use as THTML or IE, but great for whoever needs a powerful and embeddable browser.

Edit: Lars beat me to it, unfortunately

Well there is an ActiveX control based on the Gecko engine that tries to present an exact copy of the IWebBrowser API (which TWebBrowser uses).

You can find it here: http://www.iol.ie/~locka/mozilla/control.htm Unfortunately it looks like it hasn't been updated in a while. The last version is based on Gecko 1.7.12 and I believe Gecko is currently up to 1.9.x (used in Firefox 3)

An alternative is THTMLViewer component. I have used this for some years.

This is now available free. the web siteis here http://pbear.com/htmlviewers.html. According to the songbeamer web site (http://www.songbeamer.com/delphi/) there is a Delphi 2009 version available.

Over the last three years I have come across very little in the way of embedding Gecko in Delphi. One library that showed up fairly late in the game (for me) was the GeckoSDK project on SourceForge. I did a lot of work early on trying to make embedded Gecko work correctly in Delphi. Our first attempt at a Gecko rendering engine based internal "browser" was built using Delphi and Gecko 1.8. We have since moved on and our browser is now a XULRunner application. I have pieces of code laying around on my hard drive yet from that early attempt that I have not deleted yet.

When Mozilla releases Gecko 2.0 I think it will become a lot easier to embed in Delphi. The XPCOM object system in Gecko makes it very difficult to embed because most everything returns an NS_RESULT. Strings especially were hard.

edit: I just looked through my old bookmarks (almost all of which are dead) and searched for a new url for the Japanese language "bagel" browser based on Gecko and found it here,

http://github.com/plus7/bagel/tree/master/Legacy.

This is probably your best bet for some excellent code to start from. Unfortunately the comments in the code are Japanese and the author never responded to questions.

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