Using the CODEBASE attribute


 

ActiveX controls are embedded in Web pages using the <OBJECT> tag. The CODEBASE attribute of the <OBJECT> tag specifies the location from which to download the control. CODEBASE can point to a number of different file-types successfully.

For instance, CODEBASE can point directly to an .ocx file as follows:

 

CODEBASE=https://www.dbi-tech.com/whitepapers/sample1/ctBanner.ocx#version=2,0,0,1

 

This downloads and installs only the .ocx file, this solution relies on any necessary supporting DLLs already existing on the client machine. In most cases, it should not be assumed that these DLLs will exist on the client and be the correct version.

Another alternative is for CODEBASE to point to an .inf file, for example:

 

CODEBASE="https://www.dbi-tech.com/sample1/sample1.inf"

 

An .inf file controls the installation of an .ocx file and its supporting files. This method is NOT recommended because it is not possible to sign an.inf file (see the REFERENCES section for references on code signing).

The best solution is for CODEBASE to point to a cabinet file. With this method, supporting DLLs can be referenced and the cabinet file signed.

Note: If the below directions for referencing the MFC DLLs are followed, the MFC DLLs will not be downloaded if they already exist on the client. The CODEBASE line will resemble the following:

 

CODEBASE="http://example.microsoft.com/acontrol.cab#version=1,2,0,0"

 

Note here that the #Version information applies to the version of the control specified by the CLASSID parameter of the <OBJECT> tag.