Mozilla Control Frequently Asked Questions

General

What is the Mozilla control?

The Mozilla control is an ActiveX control that encapsulates the Gecko layout engine, allowing it to be used in any ActiveX container. Developers can use any ActiveX development tool such as VB, Visual C++, Delphi and even Internet Explorer to embed the Mozilla ActiveX control into a form.

The Mozilla control also uses the existing Internet Explorer interfaces meaning that it can be a drop in replacement for the Internet Explorer control in many cases.

What is Gecko?

Gecko is the layout engine lying at the heart of the Mozilla application. It consists of those DLLs that take Internet content (such as HTML/XML/CSS etc.) and render it into a window. Typically, Gecko talks to Necko which is the network layer that fetches the content from remote servers.

Who wrote the Mozilla control?

The control was written by Adam Lock with contributions / feedback from Alexandre Trémon, Neoplanet, Custom Browser and numerous developers and testers. The control makes indispensable use of the superb Gecko rendering engine, and credit for the speed and standards compliance that the control has is entirely due to the authors of this and other parts of Mozilla. 

What are the license restrictions on the control?

Distribution and use of the control is covered by the Mozilla Public License (MPL), which is discussed here, complete with annotations and a FAQ of its own.

My understanding on the license (and remember IANAL), is that your application does not need to be open source in order to use the control, though you are required make available any modifications you make to the control or other parts of Mozilla covered by the licence.

Now that you work for Netscape does that mean the control is official?

I don't work for them anymore. But it was never official during my time there (and doesn't enjoy any special status) although it appeared in every official Netscape 6.x / 7.x release.

However, classes and code of the Mozilla Control were reused to provide the ActiveX control support that was seen NS7.1. The plugin is now a standalone effort in its own right.

Will the control be released with Mozilla?

Yes, the control has been a regular feature of Mozilla releases for the last few years. If you intend to use the control from Mozilla, use the zipped up version of Mozilla, not the executable installer. The installer, puts the gecko runtimes in a separate location from the chrome and other files that the control needs so it does not function properly.

Will the control be released with Firefox?

No. Firefox is built in a way that minimizes load times by statically linking most of Gecko into one giant executable. Consequently Firefox is missing the XPCOM DLLs that the control needs to open a browser, navigate to pages etc. Use the standalone ActiveX control installer.

Will there be a port to the Mac / Linux?

Not unless someone volunteers to do it :) It would be an understatement to say it would be a non-trivial task.

Wine might offer a way to port the Gecko / control to Linux / x86 Unix systems using the Win32 API but linking to WINELib. Note that the control uses ATL which might have certain licencing issues surrounding it. The alternative is to write an open source ATL look-a-like, with the subset of functionality that the control requires. The first task though is getting a clean build for the rest of Gecko against WINELib.

Does the control run in WINE?

Yes, the last I heard it does run in WINE and might prove a replacement for the IE control in certain applications. The WINE runtime could certainly be patched to subsitute the IE CLSID for the Mozilla one at runtime if it detects IE is not installed.

Will the control be released with Netscape 7.x?

The control was released with the Netscape 7.x and 6.x series but there is no guarantee that it will ship with later versions.

Note that these days Netscape is basically a web portal brandname in the AOL empire and new releases of a branded Netscape are sporadic to say the least.

How can I contribute to Mozilla or to the Mozilla control?

In lots of ways!

I have a binary that already uses IE, can I make it use Mozilla?

Yes, use the IEPatcher tool to patch the original binary. Results may vary from app to app.

Note that I won't accept bugs reported against patched apps. I must have reproducible test cases and source code. For example, please try and reproduce the problem with some simple VB or in the CBrowse test application.

Downloading the control

Where do I get the control from?

The control is part of the Mozilla release and can be fetched as source code or as a binary in a nightly build or milestone release. For example, you may find the Mozilla 1.0 here.

Important Note: From 1.5 onwards, the Mozilla installer breaks the functionality of the control (see next question). So I have produced a standalone installer, download details for which can be found here.

Why does the Mozilla installer break the control?

The installer now splits Mozilla into two directories - a GRE directory under "Program files\Common files\Mozilla.org\GRE" contains the Gecko runtime engine and the actual Mozilla directory (specified by the user during installation) contains the chrome and application DLLs. The mozctlx.dll is installed in the GRE directory but cannot locate the chrome it needs (which is in the Mozilla part). Therefore it breaks.

Either install Mozilla from the .zip file, or use the Mozilla Control's standalone installer.

Can I use the control in Mozilla Firefox?

No, use it from Mozilla or from the standalone installer.

Some builds of Firefox may contain the control, but Firefox statically links most of the GRE runtime into firefox.exe. The control won't work without the runtime.

I installed Mozilla 1.x but I can't find mozctlx.dll!

From Mozilla 1.5 onwards the control is installed in the GRE directory but see the last question which explains why the control does not work from the Mozilla installer executable.

Either install Mozilla from the .zip file, or use the Mozilla Control's standalone installer.

What is the standalone installer?

The standalone installer takes the control and the ripest, juciest, sun ripened parts of Mozilla (otherwise known as Gecko) and packages them into an .exe that self extracts and installs them into a standalone directory. The result is a control which has no dependencies on any other version of Mozilla or the GRE you may have installed on your machine.

The installer contains everything you need and ever registers the control.

The installer should prove very useful for third party apps which don't want the bother or bulk of redistributing an entire version of Mozilla just to get the control.

What do I need to do to use the control after I install Mozilla?

You must register it. Once you have registered the control you should be able to insert it into your VB application as you might any other control.

Can you send me a copy of the control?

Sorry no. A fully compiled control plus accompanying DLLs is simply too large for my poor modem to send out on demand.

Check out my website for the standalone installer, or ftp://ftp.mozilla.org for the latest Mozilla builds.

If you are after a particular bug fix, then you will have to wait for it to be checked in and grab the next trunk build. Alternatively, apply the patch manually to your own copy of the source and build your own copy.

Maybe you misunderstood, could you send me just the control DLL and not the other bits?

It is not possible to just send the Mozilla control on its own. The control's DLL has runtime linker dependencies on other DLLs within Mozilla. Unless your copy of Mozilla was built with exactly the same build tools, from the same source code and with the same environment settings as mine it will not work. 

What about if I were to fetch 1.5 or some other milestone. Could you build and send me just the control DLL then?

Again no. I work against the latest CVS image I have downloaded, I do not have the space or the time to maintain multiple "trees" to build software on demand.

Installation and configuration

Why doesn't my control work?

You have to be more specific. Did you read through the control troubleshooting section?

I did everything you say to do but it still doesn't work!

Try posting a query to the the netscape.public.mozilla.embedding newsgroup.

What C++ runtime DLLs do I require?

Assuming that you downloaded from Mozilla.org, then you currently need MSVCP60.DLL and MSVCRT.DLL. Chances are that you already have these files from installing some other application, but if you don't they are here for your convenience. Unzip the file and put the dlls into you windows\system directory or winnt\system32 on XP/NT/2000.

The standalone installer automatically installs the runtime DLLs you need.

What is this MSVCP60.DLL / MSVCP70.DLL?

The Mozilla control uses STL (C++ standard template library) to manage some collections. STL is mostly C++ template and inline code but certain support routines are in a separate DLL.

I am slowly removing the STL code to remove this dependency and to reduce the surprising amount of bloat STL introduces.

What DLLs and other files do I need to use the control?

The Mozilla control relies exclusively on the underlying Gecko engine for its functionality so it makes it very difficult for me to specify with certainty files are necessary and which ones aren't since some are optional. A good reference is the embedding distribution which contains a typical set of DLLs and files for shipping in embedding circumstances. I say typical because the needs of embedders can vary - some people only want western character and http support while others might need ftp, https and so on.

Where is the control's profile stored?

Starting with Mozilla 1.3, the profile is stored seperately from the Mozilla profiles. It may be found in the "Application Data" folder of the current user under "MozillaControl". For example, "C:\Documents and Settings\Administrator\Application Data\MozillaControl"

How do I change preferences for the control, e.g. the proxy settings?

Edit the control profile's prefs.js and change the settings to those that you want.

Alternatively open about:config and configure the settings from there.  You could also create a fresh profile in Mozilla / Firebird, change the settings from the preferences dialog and copy resultant the prefs.js over into the control's profile.

What chrome do I need to use the control?

The standalone installer contains all the chrome you need.

Hand rolling chrome is not easy, you may be better off taking the chrome subset contained in the nightly embedding builds if you're not comfortable crafting your own. Or use the standalone ActiveX control installer.

Which newsgroups deal with the Mozilla control?

The main newsgroup for control issues is netscape.public.mozilla.embedding. The control is also mentioned occasionally in netscape.public.mozilla.general and netscape.public.mozilla.xpcom.

Emulation Issues

How closely do the Mozilla and IE controls behave?

They have reasonably similar behaviour when controlled via IWebNavigation and IWebNavigation2 but the Mozilla control has limited support for the DOM. Event firing is similar but not exact. Browser helper objects are implemented but not tested extensively. The IE 5 DOM is not supported at all, but may be when the Mozilla build system moves up to Visual Studio .NET.

How can the Mozilla control be binary compatible with the IE control?

ActiveX (or rather COM) is a binary standard for defining the APIs that a control exposes. It allows controls and other types of object to be interchangeable as long as they implement the same APIs and function in the same way through those APIs. The Mozilla control attempts to do exactly this, emulating Internet Explorer control as closely as possible so that host applications cannot tell them apart.

How compatible will the behaviour be to the IE control?

In normal use, the two controls will behave very similarly. The API is the same, the behaviour is similar and as long as you stick to W3C compliant HTML you should no problems either.

If you require access to the DOM then you should note that the Mozilla control offers a subset of the IE behaviour and follows the W3C DOM standard which may differ from the IE model.

What interfaces will you support?

The IWebBrowser, IWebBrowser2 and IWebBrowserApp interfaces will be implemented. Much of the IE DOM will also be implemented albeit in a limited manner.

Will you support the IE DOM model?

Yes, though the hierarchy of objects will follow the Mozilla model (i.e. DOM 1) and not Internet Explorer. The differences may require changes to applications hardcoded to expect the IE model.

Other methods may be implemented but many return E_NOTIMPL. I would welcome patches to improve this support.

Will you support the IE XML model?

Maybe. I have written a sample wrapper for James Clark's expat that emulates the IE4 model but it is not built by default into Mozilla. The IE5 model is considerably more complicated and would require considerable work to emulate adequately.

What support is there for JScript, VBScript?

No, Mozilla uses the scripting capabilities of Gecko which has no support for languages written around the ActiveScript mechanism. In theory Mozilla's XPConnect might allow such languages to be supported one day, but not at the moment. 

Can I automate Mozilla (the application) via ActiveX?

Maybe some day, but the control won't help here. The control is a DLL wrapper around the Gecko rendering engine and is not part of mozilla.exe. At the time of writing, Mozilla has no automation interface so you cannot control it via IWebBrowser or any other ActiveX interface.

I would like to see Mozilla gain such a capability but it would probably be as much work again to achieve as the control was to implement. Where feasible I have been refactoring code in the control to make the IWebBrowser implementation more reusable.

Having said that, Mozilla is an extremely open architecture, so if you want to slot in your own remote control XPCOM object or whatever, it should be possible to do it.

Why isn't the Mozilla ActiveX control marked safe for scripting?

Because it isn't safe for scripting. It would be easy enough to programatically crash the control, or exploit some implementation detail so I can't mark it as safe. Sorry.

Programming

Where is the Mozilla control?

It's part of the Mozilla source code, currently under mozilla/embedding/browser/activex/src/control.

Can I build the Mozilla control without building all the other Mozilla stuff?

No. The control is a wrapper layer sitting on top of the Mozilla rendering engine and won't compile unless the stuff it depends on has also been built.

Instructions on how to build Mozilla are here.

How do I use the control from C++?

The simplest way is from a project created with Devloper Studio's MFC AppWizard.

  1. Create a dialog based project
  2. Choose "Project|Add to project|Components and Controls..." from the menu
  3. Locate the Mozilla browser control from the dialog and hit OK
  4. Choose appropriate names for the classes the wizard generates, e.g. CWebBrowser
  5. Go to the dialog resource editor and insert a Mozilla Browser component onto your dialog
  6. Select the new component and run the ClassWizard.
  7. From the variables tab, create a new member variable for the component
  8. Call methods on the variable to drive the browser

You may reuse the existing MFC CHtmlView class, instructions for which are here.

How do I use the control from .NET?

This section is work in progress, but see the front page for info about CSBrowse. The control works fine from .NET apps, but the control is regarded as unmanaged code.

If you're looking for a cross-platform solution, then some day, the GTK browser widget may be a better fit That is if the Mono crew consider doing their own thing instead of aping MS at every step, and produce a viable GTK# with a component for browsing.

How do I use the control from VB?

  1. Right-mouse click on the toolbox and select "Components..."
  2. From the selection list, check the Mozilla control type library and click OK
  3. The Mozilla browser control appears on the toolbox
  4. Add a Mozilla browser control to the form
  5. Call methods on the control to drive the browser

How do I use the control from Delphi?

I don't own Delphi, but as it is an ActiveX container it should be possible to generate a wrapper class for the Mozilla control as you can for any other ActiveX control. See your documentation for details how to do this.

How do I use the control from IE?

Add a tag like this to your HTML:

<object classid="clsid:1339B54C-3453-11D2-93B9-000000000000" id="MozillaBrowser1" width="240" height="240">

</object>

Use VBScript or Javascript to drive the browser. Here is a sample page.

How difficult is it to port some existing code from IE to the Mozilla control?

The stated aim of the Mozilla control is to be as compatible with the IE control as possible but certain advanced features may be difficult to implement using the Gecko rendering engine. In particular this means DOM manipulation, particularly using the large number of IE interfaces introduced with IE 5 & 6. 

Therefore it depends on the complexity of your application. If your application does little more than instantiate the IE control and tell it to browse somewhere then the chances are that the Mozilla will be a drop in replacement.

The other end of the scale is if your app expects to parse the HTML DOM via COM interfaces, modify properties and generally do things via the automation interfaces then you should check out the progress so far to see if it meets your needs. Likewise, the Mozilla control isn't likely to work with IE-specific DOM/HTML extensions, VBScript and so on.

How do I port some C++ to use the Mozilla control?

That depends on the classes you are using. In general it requires replacing references to the Internet Explorer CLSID with the Mozilla one. MFC & ATL provide classes for using the IE control, you may have to make duplicate these classes, making your implementation reference the Mozilla CLSID.

More info can be found in the C++ section of the control page, here.

Why do you use ActiveX instead of Bonobo, Corba, Opendoc etc. ?

The Mozilla control is a binary replacement for the IE control so the choice of object technology was predetermined. 

What can't I do with the Mozilla control?

The Mozilla control uses the Gecko rendering engine which is dedicated to open standards. That means the control will not display any content that contains proprietary Internet Explorer markup such as VBScript, or certain extensions to DHTML or CSS.

Why would I want to use the Mozilla control over the IE one?

There are plenty of reasons:

  1. You get a standards compliant HTML rendering engine with full support for HTML, XML, CSS 1, CSS 2 (and some CSS 3), DOM 1 & 2 with optional support for SVG, MathML and XSL. Contrast this with the half-baked implementation of these standards in IE 4, 5, & 6.
  2. Small distributable - Anywhere from 4 megabytes (for the control plus embedding distribution) compared to 30Mb+ for IE.
  3. No redistribution licence - You don't have to register your product with Mozilla.org and you don't need to use newer versions of Mozilla if you don't want to.
  4. Total customisability - Modify the source to your heart's content.
  5. Total access to the source code - If you encounter a bug you can go and fix it yourself
  6. Community support - If you have a question, you can talk directly to other Mozilla volunteer developers in one of the many Mozilla newsgroups, you can raise bugs, browse the source submit patches and more.

Will you support the IE DHTML editor mode?

Maybe. Some initial work was done on such a mode but it remains to be seen how feasible it would be to implement a usable subset.

The Mozilla layout engine can switch between edit and presentation modes, so the potential is there.

I want to create my own control using your control, what should I be aware of?

Well firstly, your modifications and your control are subject to the terms of the MPL

Secondly, your control cannot use the same CLSID as the Mozilla control. Absolutely not. If you do so, Windows cannot distinguish between your control and the default Mozilla control. This will lead to serious problems when your control and the Mozilla control are installed on the same machine and compete to see who's registered first. Change all instances of the Mozilla CLSID in the cpp, rgs and idl files to your own.

Likewise, if you start changing around any of the Mozilla/IE interfaces defined in MozillaControl.idl.

Developer Studio has two tools for generating new UUIDs (CLSIDs, IIDs etc.). The easiest is guidgen, but there is also a command line tool called uuidgen. It's easy to create a new CLSID by running either tool and replacing the value of CLSID_Mozilla with the value that it generates. Remember to do this anywhere the default Mozilla CLSID appears in the source code.

How do I submit a change or fix?

Send me message stating what you want to fix or improve. If it's a simple fix, attach it otherwise it's best to give me an idea on what you plan and the likelihood that it will be accepted.

I will only accept modifications that improve the compatibility with the Internet Explorer control. This does not stop you from developing your own control If you wish but read above on how to create your own control.

DOM Issues

I can't access document.body!

Load "about:blank" during initialisation to ensure there is a document.

I can't see DOM objects in my VB / .NET application

TODO check your project references - pull in the IE mshtml TLB if necessary to obtain definitions for IHTMLDocument, IHTMLBody etc.

What DOM support is there?

At present the Mozilla control implements IHTMLDocument, IHTMLElement & IHTMLElementCollection. It should be possible to walk the DOM quite satisfactorily, as well as call get_all and other methods that return a collection. You may also write to a document with calls to open, write, writeln, & close on IHTMLDocument. You may also call setAttribute, getAttribute & removeAttribute on elements asl well as get the className & id but not set them.

I call property X but it says E_NOTIMPL!

There is a better chance that a property or method will be implemented if there is a straight 1:1 mapping between the IE and Gecko DOMs. If a specific property is not there, you can still call setAttribute or getAttribute to grab it. You can still walk the DOM and manipulate objects via the more generic IHTMLElement and IHTMLNode interfaces.

Is there a DOM compatibility table?

TODO - there should be a table listing what interfaces the control supports & major methods but at the moment there is no such thing. The best that can be done for now, is to look at the actual implementation of the DOM objects in mozilla/embedding/browser/activex/src/common on lxr.mozilla.org and check if interface or method X is actually supported.

ActiveX Plugin

What is the ActiveX plugin?

It is a plugin designed to allow ActiveX controls to run inside Netscape Communicator 4.x and Mozilla. 

Does it support scripting?

The ActiveX control can support scripting through a hardcoded interface in LiveConnect on 4.x and XPConnect on Mozilla 6.0-7.0. The plugin built for Mozilla 1.4 and Netscape 7.1 supports near transparent scripting thanks to COM connect

What is COM connect?

COM connect is a bridging layer written by David Bradley to transparently support ActiveX automation inside of XPConnect. It works by mapping data types, querying type libraries and much more to seamlessly bring the two together. When the plugin is built with COM connect support, it exposes the IDispatch interface of the control through the plugin API and the COM connect layer transparent maps it into XPConnect. The upshot is that you can call directly methods on ActiveX objects from JavaScript.

My control wants to access the IE DOM, does the plugin implement any of this?

The plugin implements some of the IE DOM to support things such as link clicking, access to IWebBrowser etc. It is likely to remain skeletal. Some controls such as the Windows Media Player and the Shockwave control dip into the DOM to do form submits, targetted links, closed captioning and more. The plugin tries to implement just enough IE DOM functionality to support such controls.

Reporting Bugs

How do I submit a bug report?

Using Bugzilla. Please be sure to read the bug reporting guidelines.

How do I see what bugs are outstanding on the ActiveX control?

Run a Bugzilla query like this one.

How do I know if a bug is the fault of the control or Gecko?

The simplest way is to run the same content in mozilla.exe and see if the same fault occurs there. If it does then its likely caused by a problem in Gecko and is not an issue with the control wrapper.

It is important to identify as closely as possible where the problem might be to ensure that the right module owner gets to see it.

Back to Main Page