Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

ActiveX Control for Hosting Netscape Plug-ins in IE

Introduction

Microsoft has removed support for Netscape plug-ins from IE 5.5 SP 2 and beyond. If you are a plug-in author, you may find this project saves you a lot of work!

This page describes a control that implements the NP API and hosts most Netscape-compatible plug-ins. Now you can use your plug-ins in any recent version of IE or in any other ActiveX container for that matter. The control itself is implemented in a DLL called pluginhostctrl.dll which is standalone from the rest of the Mozilla project.

If you're wondering how Microsoft used to support the NP API, look for a file called plugin.ocx in your Windows system directory. This 100k ActiveX control contains the entire NP API implementation and probably worked much like pluginhostctrl.dll does now.

The sections below tell you how to fetch, build and use the pluginhostctrl.dll .

Get the source

You need CVS to get the source code. Assuming you have CVS somewhere in your path, type this from a command prompt:

C:\> set CVSROOT=:pserver:[email protected]:/cvsroot
C:\> set HOME=\TEMP
C:\> cvs login
(Logging in to [email protected])
CVS password: anonymous
C:\> cvs -z3 co mozilla/embedding/browser/activex/src/pluginhostctrl

This fetches the source for the control into mozilla\embedding\browser\activex\src\pluginhostctrl.

You can also see the code online.

Build it

It is quite simple to build the control

  1. Locate the pluginhostctrl directory:
  2. Open pluginhostctrl.dsp
  3. Build "Win32 Debug" or another target
  4. Open some of the test files under pluginhostctrl\tests in Internet Explorer to verify the control has built and registered correctly.

The control currently reads plug-ins from your most current Netscape 4.x and IE installations. There is no support for Mozilla or NS 6.x yet.

A note to developers

If you intend to modify this control IN ANY WAY then you MUST also change the CLSID from {DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2} to something else and any other GUIDs this control relies upon (IID, LIBIDs etc). This is necessary so that your control may coexist with the generic version and any other versions that other plug-ins vendors may have installed.

It is advisable to rename the control and not to install somewhere like the Windows directory where it is likely to be overridden.

Use a tool such as guidgen.exe or uuidgen.exe to create the new GUIDs.

Package it

There is a subdirectory named cab/ which contains a script and a README.txt for producing your own signed CAB files.

Manual installation

Assuming you have the precompiled pluginhostctrl.dll and wish to install it on a machine, you must register it either through an install script or manually:

regsvr32 pluginhostctrl.dll

You must have administrator privileges to install a new control on operating systems such as Windows NT, 2000 & XP.

Usage

Insert some HTML like this into your content:

    <OBJECT classid="CLSID:DBB2DE32-61F1-4F7F-BEB8-A37F5BC24EE2"
        width="500" height="300">
      <PARAM name="type" value="video/quicktime"/>
      <PARAM name="src" value="https://www.foobar.com/some_movie.mov"/>
      <!-- Custom arguments -->
      <PARAM name="loop" value="true"/>
    </OBJECT>

The CLASSID attribute tells IE to create an instance of the plug-in hosting control, the WIDTH and HEIGHT specify the dimensions in pixels.

You may optionally specify a CODEBASE attribute if you have packaged the control into a CAB file and wish for it to be installed automatically.

The following <EMBED> attributes have <PARAM> tag equivalents:

  • <PARAM name="type" ...> is equivalent to TYPE
    Specifies the MIME type of the plug-in. The control uses this value to determine which plug-in it should create to handle the content.
  • <PARAM name="src" ...> is equivalent to SRC
    Specifies an URL for the initial stream of data to feed the plug-in. If you havent't specified a "type" PARAM, the control will attempt to use the MIME type of this stream to create the correct plug-in.
  • <PARAM name="pluginspage" ...> is equivalent to PLUGINSPAGE
    Specifies a URL where the plug-in may be installed from. The default plug-in will redirect you to this page when you do not have the correct plug-in installed.

You may also supply any custom plug-in parameters as additional <PARAM> elements.

Still to do

  • Only hosts windowed plug-ins.
  • An official pluginhostctrl.cab file.
  • Doesn't work for the Adobe Acrobat plug-in yet.
  • Plug-ins cannot create writeable streams or seek in readable streams.
  • LiveConnect scripting is not supported. If you need scripting functionality, consider shipping a modified pluginhostctrl.dll that exposes methods you wish to call on your plugin.

Document Tags and Contributors

 Contributors to this page: teoli, Ptak82, NvhD4a, Josh
 Last updated by: Ptak82,