What bits do I need?
One of the requirements of building a SDK is the ability to identify and package up required files. Like that isn't totally obvious, nonetheless it has to be done. Here is that effort.
I have created a directory under embedding called config. Contained within this directory are a couple of makefiles:
After the build is done, you can change directory into
mozilla/embedding/config, and do a
make. This will produce a directory in
Embed. It should include all of the base support that you need to get a web browser started up.
Included is the sample test application (
What initializations do I have to do?
Somewhere during the start of your application, you must initialize [XPCOM]. You will also want to shut this down when you quit.
Other initialization must be done to start up event queues and load some string bundles. All of this is somewhat generic and has been isolated into a static library that you can simply call on.
If you build
mozilla/embedding/base/, a static library (on windows) called
baseembed_s.lib is built. Just link this library to your application. There are two functions that are needed:
nsresult NS_InitEmbedding(const char *aPath); nsresult NS_TermEmbedding();
Pretty self-explanatory. The
aPath parameter will be passed to NS_InitXPCOM. NS_InitEmbedding() must be called from the main thread of your application, otherwise it won't work.
Do you have any simple examples of embedding Mozilla?
There are many examples of products already using Gecko for embedding. Here's a partial list. The sections marked 'Mozilla Examples' refer to clients and sample code to be found within the Mozilla source tree.
- SashXB: IBM uses Mozilla to implement part of their Sash development/desktop environment. Part of the GNOME effort.
- Light: Very simple non-bloated GTK+ interface, familiar Netscape 4.x keyboard shortcuts, context menus, etc. (Screenshot)
- XParts: KDE extension that allows Mozilla to be embedded into the Konqueror browser. Uses GtkMozEmbed widget, part of the kdebindings module and available from http://websvn.kde.org/trunk/KDE/kdebindings/xparts/. (News release, screenshot)
- GtkMozEmbed widget: Gtk widget wrapper for the Mozilla Gecko Engine.
- TestGtkEmbed: Basic browser built with the GtkMozEmbed widget. URL location field, menu bar, html area, supports SSL.
- K-Meleon browser: the Windows answer to Galeon. Fast IE-look-alike browser, uses IE and NS bookmarking system, fast loading time, privacy features, Java support and complete control of the menus and "hotkeys". Implemented with Mozilla embedding APIs. (Screenshots)
- Neoplanet browser: A Gecko add-on for the NeoPlanet browser.
- Macromedia HomeSite HTML Editor: Internal browser for the Homesite Studio application is implemented by embedding Mozilla. (Mozilla blurb)
- Bradsoft's TopStyle CSS builder: Implements an internal browser using Mozilla ActiveX embedding control. Obsolete since Gecko 7.0
- ActiveX control: An ActiveX control allowing for embedding the Gecko layout engine. Obsolete since Gecko 7.0
- LLMozLib & uBrowser: a static library that allows you to embed Gecko and render pages to memory. Includes test applications that illustrate how to use it. Versions for Windows and Mac with Linux to follow.
- mfcEmbed: Standard Mozilla embedding example application for win32. Basic browser, menus, toolbar, URLbar, html area.
- winEmbed: Obsoleted by mfcEmbed. A bare-bones browser with URLbar and html area.
- ActiveX control: An ActiveX control for Mozilla using the Gecko layout engine. More information at 1 and 2.
: Mac port of
(ja, ko) embedding Mozilla.
- PPEmbed: Standard Mozilla sample application implemented with Metroworks' Powerplant.
- Camino: A project aimed at delivering a best-of-breed browser on the Mac OS X platform. Camino uses Cocoazilla, a variant of Fizzilla that consists of a UNIX back end wed to a Cocoa front end.
- Java Webclient: Provides a browser-neutral Java API that enables generic web browsing capability.
- BrowserG!: A Java application that uses Webclient for HTML rendering and surfing capabilities.
If you find any missing item, please send me an email.
Original Document Information