36

Using the default TWebBrowser makes things easy to embed a web browser. Unfortunately the one that comes in by default is IE<n>.

I'm wondering how does one integrate a Gecko or WebKit one.

  1. Are there VCL examples somewhere?
  2. If not, how would one go about doing it?
  3. Where's the best place to find the core for Gecko and/or WebKit in an embeddable format?
JeffV
  • 52,985
  • 32
  • 103
  • 124
Gustavo Carreno
  • 9,499
  • 13
  • 45
  • 76

5 Answers5

21

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

Time has moved on

This answer is from '08 and since then time has moved on. The links don't work anymore and there are probably better alternatives now.

Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
16

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.

Carlos Barbosa
  • 3,083
  • 5
  • 30
  • 30
  • Thanks for the tips Carlos. Just a little favour: Could you add a link to those URLs you mention? I don't have the power to edit your answer :) Thanks. – Gustavo Carreno Aug 22 '10 at 21:07
  • 1
    Latest version of Chromium embedding (CEF) can be found here: https://github.com/salvadordf/CEF4Delphi – R. Hoek Nov 03 '19 at 18:41
3

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)

Otherside
  • 2,805
  • 22
  • 21
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.

dcraggs
  • 758
  • 4
  • 10
  • 3
    As the original author of PBear is not able to support the code anymore, we've moved the development on this to : http://sourceforge.net/projects/htmlviewer – PatrickvL Oct 03 '08 at 06:05
  • @PatrickvL: Is the HtmlViewer software still being further developed ? – Edelcom Aug 08 '10 at 05:28
  • 2
    @Edelcom : If you look at the htmlviewer project website, you'll see it was moved over to google code in the mean time. If you look here http://code.google.com/p/thtmlviewer/updates/list you'll see that the most recent activity was only a few days ago, so I think the answer is 'Yes!'. ;-) – PatrickvL Aug 09 '10 at 05:42
2

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.

TomC
  • 1,871
  • 1
  • 12
  • 18