Generic ActiveX Detector for Internet Explorer

ActiveX control classid:
max digits:

     (upper limit for each digit of detected version)





Introduction

The generic ActiveX detector shown above can detect many different ActiveX controls. Simply specify the ActiveX classid and the maxdigits parameter, and the detector will return the control's status and version. This ActiveX detector works only for your Internet Explorer browser.

This is a generic plugin/add-on/ActiveX control detector for Internet Explorer.



A few PluginDetect commands for ActiveX detection

PluginDetect.getVersion('ActiveX', classid, maxdigits): [Returns string or null]
   Returns the version (as a string) of the installed ActiveX control.
   Returns null when the version could not be determined (when the ActiveX control is not installed/not enabled, or is installed but the version information is unavailable).

By default, the returned version string is comma delimited and has the format of "A,B,C,D". If you wish to change the getVersion( ) delimiter, then use:
   PluginDetect.getVersion(delimiter) where delimiter is a string with exactly 1 character.

For example,
   PluginDetect.getVersion(".");   // set delimiter
   var version = PluginDetect.getVersion("ActiveX");    // version has the format of "A.B.C.D"


PluginDetect.isMinVersion('ActiveX', minVersion, classid):
[Returns number]
   Returns 1 if ActiveX control is installed & enabled for the specified classid, and the version is >= minVersion.
   Returns 0 if ActiveX control is installed & enabled for the specified classid. The version is unknown, and thus we are unable to determine if version >= minVersion.
   Returns -0.1 if ActiveX control is installed & enabled for the specified classid, but version is < minVersion.
   Returns -1 if ActiveX control is not installed or not enabled.
   Returns -3 if you supplied a bad input argument to the isMinVersion( ) method.


minVersion: [string or number input argument]
   This is the minimum ActiveX control version.
   Can be a string such as  '1,5,0,0' or '1.5' or '1,5,0,1' or '1.5.0.1' etc...
   Can be a number such as 0 or 1.5 or 1.50 etc...
   If minVersion is not specified, then PluginDetect will assume minVersion is '0'.
   Strings are more versatile than numbers since '1,5,0,1' cannot be expressed as a number.


classid: [string]
   The classid specifies the ActiveX control that you wish to detect.
   The format of the string is "clsid:{identifier}". As an example, "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6". You can use upper or lower case letters if you wish. Spaces in the string are ignored.
    The classid string may also specify a mimetype (ie. "application/x-java-applet", etc...). However, a mimetype can be associated with more than one ActiveX control, so there is no way to guarantee which ActiveX control actually gets detected. You are usually better off using "clsid:{identifier}".
    
maxdigits: [Array of 4 numbers]
   The maxdigits input array specifies the maximum allowed value for each digit of the detected version. This array is only required by the getVersion( ) method, not the isMinVersion( ) method.
   Each number in the maxdigits array must be an integer >=0 and < 99999999. So [10, 0, 99, 8] is acceptable, but [-3, 5.6, 999999999999999, 0.9] is not acceptable.
   If you specify less than 4 numbers in the array, then the remaining numbers are assumed to be 0. For example, [7, 99] will be interpreted as [7, 99, 0, 0].


Given an ActiveX control that has a version of "c0, c1, c2, c3"
Given a maxdigits array of [m0, m1, m2, m3]
Given that PluginDetect.getVersion("ActiveX", classid, maxdigits) returns a version of "v0, v1, v2, v3"

then we define their relationship as follows...

If c0 <= m0 then v0 = c0
otherwise v0 = m0

If c0 <= m0 and c1 <= m1 then v1 = c1
otherwise v1 = m1

If c0 <= m0 and c1 <= m1 and c2 <= m2 then v2 = c2
otherwise v2 = m2

If c0 <= m0 and c1 <= m1 and c2 <= m2 and c3 <= m3 then v3 = c3
otherwise v3 = m3

 


Detection Speed

Because PluginDetect.getVersion("ActiveX", classid, maxdigits) uses a brute force search algorithm, the version detection can be very slow. However, you can speed up the version detection by carefully selecting your maxdigits array. We assume here that maxdigits is given by [m0, m1, m2, m3], and the ActiveX control version is given by "c0, c1, c2, c3".

When we specify that m0 >= c0, m1 >= c1, m2 >= c2, m3 >= c3, then all 4 digits of the ActiveX control version will be detected.

But what if we only needed to detect the first 3 digits of the ActiveX control version? In that case, our detection would be a bit faster because we don't have to do our brute force search for the 4th digit. To accomplish this, we set m3=0. And so our maxdigits array would be [m0, m1, m2, 0] where m0 >= c0, m1 >= c1, m2 >= c2.

Faster still would be to only detect the first 2 digits of the ActiveX control version. The maxdigits array would be [m0, m1, 0, 0] where m0 >= c0, m1 >= c1.

And faster still would be to only detect the very first digit of the ActiveX control version. The maxdigits array would be [m0, 0, 0, 0] where m0 >= c0.


Another factor that affects detection speed is the actual size of the numbers in the maxdigits array. The larger the numbers in the array, the longer the version detection will take. For example, if an ActiveX control has a version of "1, 5, 2, 23" then a maxdigits of [20, 20, 20, 30] is faster than a maxdigits of [999999, 999999, 999999, 999999]. In other words, do not make the numbers in the maxdigits array unnecessarily large.


If detection speed is still an overriding concern, then you may want to avoid the PluginDetect.getVersion("ActiveX") method altogether, and use only PluginDetect.isMinVersion("ActiveX"). The isMinVersion( ) method in this case is much faster because it does not use any kind of brute force search at all.



Limitations

There are a few limitations associated with this ActiveX control detector...

 

1) It will only work for Internet Explorer 7 and higher. [I have not had a chance yet to test 64 bit Internet Explorer.]

2) ActiveX needs to be enabled in the browser, and ActiveX filtering needs to be turned off.

3) The ActiveX control needs to have security approval to run when instantiated by an <object> tag. During detection, the control is instantiated by PluginDetect via an <object> tag, such as:

   <object width="1" height="1" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="#version=0,0,0,0">
   </object>

Many, but not all, ActiveX controls can be instantiated with an <object> tag.

4) The ActiveX control must also be compatible with the codebase parameter in the <object> tag. The codebase parameter is used in order to detect the version of the ActiveX control. Normally, any ActiveX control that can be instantiated with an <object> tag would allow you to specify the codebase parameter.

However, I did come across one exception. The Adobe Reader plugin (at least Adobe Reader 11) did not behave very well when I instantiated it using an <object> tag with the codebase parameter. It would appear to be some kind of bug.

5) On the other hand, there is no need to use the ActiveX detector to detect Adobe Reader anyway, since PluginDetect already has a built in Adobe Reader detector that is much faster.
If PluginDetect already has a built in detector for a specific plugin, then you are probably better off using that, as opposed to the generic ActiveX detector.






Top of Page