Adobe PDF Reader Plugin Detector




A few PluginDetect commands for Adobe Reader detection

PluginDetect.getVersion('AdobeReader', DummyPDF): [Returns string or null]
   Returns the version (as a string) of the installed Adobe Reader plugin. When getVersion( ) returns a version, it only means that the plugin is installed. It does NOT necessarily mean that the plugin is enabled.
   Returns null when the version could not be determined (when plugin is not installed/not enabled, or plugin 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("AdobeReader");    // version has the format of "A.B.C.D"


PluginDetect.isMinVersion('AdobeReader', minVersion, DummyPDF):
[Returns number]
   Returns 1 if plugin is installed & enabled and plugin version is >= minVersion. You can view PDF documents by using the browser (with the plugin) and/or by using the standalone Adobe Reader application [depending on the browser settings and the standalone application settings].
   This detection result does NOT guarantee that the Adobe Reader plugin is the default PDF viewer in the browser, however. It is possible that the browser may have other PDF viewer(s) installed, and that the browser will simply use one of those other viewers instead of Adobe's. Again, this depends on the browser preferences/settings, etc...
   Trying to detect when the Adobe plugin is the default PDF viewer across all browsers, all platforms, and all possible configurations is impractical at best. There are too many problems in trying to detect this.
   However, it is possible to detect when Firefox's native PDF Reader is the default in Firefox. So any conflict between the Adobe plugin and the Firefox PDF Reader can be revealed by specifically trying to detect the Firefox PDF Reader. Or better yet, we can combine the Adobe PDF and the Firefox PDF detectors.

   Returns 0.5 if plugin detection has been initiated but is not yet completed. At this point in time, the plugin appears to be installed & enabled. Detection is occurring NOTF (Not On The Fly), so you will have to wait until the detection has completed. Only certain plugins (on certain browsers and platforms) require NOTF.
   In order to handle NOTF detection, it is recommended that you use the onDetectionDone( ) method. This method will call an event handler after plugin detection has fully completed. The handler can call the isMinVersion( ), getVersion( ) and getInfo( ) methods to obtain the final plugin detection results.

   Returns 0 if plugin is installed & enabled. The plugin version is unknown, and thus we are unable to determine if version >= minVersion. You can view PDF documents using the browser (with the plugin) and/or the standalone application [depending on the browser settings and the standalone application settings.]
[Note: this detection result does NOT guarantee that Adobe Reader is the default PDF viewer in the browser.]

   Returns -0.1 if plugin is installed & enabled, but plugin version is < minVersion. You can view PDF documents using the browser (with the plugin) and/or the standalone application [depending on the browser settings and the standalone application settings.]
[Note: this detection result does NOT guarantee that Adobe Reader is the default PDF viewer in the browser.]

   Returns -0.15 (Internet Explorer only) if plugin is installed but not enabled for <object>/<embed> tags. The plugin version cannot be detected. The browser + Adobe plugin are unable to use <object>/<embed> tags to display PDF documents. This result occurs for Internet Explorer when the Adobe Reader ActiveX control is disabled in the add-ons menu.
   However, for Internet Explorer and Adobe Reader 10 (and lower), a PDF document can still be displayed in the browser window. Apparently the ActiveX control is not needed in this case.
   For Internet Explorer and Adobe Reader 11 (and higher), PDF documents will not display in the browser window when the ActiveX control is disabled. Instead, the PDF is downloaded by the browser, and then the standalone Adobe application starts up to display the PDF.
   So for this detection result, depending on the browser settings and the standalone application settings and the Adobe Reader version, a PDF document can be viewed in the browser (with the plugin) and/or in the Adobe Reader standalone application.
[Note: this detection result does NOT guarantee that Adobe Reader is the default PDF viewer in the browser.]

   Returns -0.5 if plugin detection has been initiated but is not yet completed. At this point in time, it is unknown whether the plugin is installed or not. Detection is occurring NOTF (Not On The Fly), so you will have to wait until the detection has completed. Only certain plugins (on certain browsers and platforms) require NOTF.
   In order to handle NOTF detection, it is recommended that you use the onDetectionDone( ) method. This method will call an event handler after plugin detection has fully completed. The handler can call the isMinVersion( ), getVersion( ) and getInfo( ) methods to obtain the final plugin detection results.

   Returns -1 if plugin is not installed / not enabled. You cannot view PDF documents in the browser with this particular plugin because the Adobe plugin is not installed / not enabled. There are several possible reasons for this detection result:
  1) The Adobe Reader software is not installed on your computer.
  2) The Adobe Reader software is installed on your computer, but it is disabled in your browsers settings/preferences. For example, in Firefox you can disable the plugin completely, and so the Adobe Reader plugin + Firefox browser will be unable to display PDF documents. However, the user can still download PDF docs and view them in the Adobe Reader standalone application.
  3) The Adobe Reader software is installed on your computer, but within the Adobe standalone application preferences, the "Display in Browser" option is disabled. In this case, the Adobe plugin is disabled and will not display any PDF docs within the browser. It is not possible to detect the plugin either. But the standalone app itself naturally can still display PDF docs. [Note: for Adobe Reader 11 and higher, it appears that the "Display in Browser" option is no longer present in the Adobe standalone preferences.]

   Returns -1.5 (Internet Explorer only) if plugin status is unknown. ActiveX is disabled and/or ActiveX Filtering is enabled in the browser, and therefore it is not possible for PluginDetect to determine if the Adobe Reader plugin is installed or not.
   If the Adobe plugin is installed, then the browser + Adobe plugin will be unable to use <object>/<embed> tags to display PDF documents. However, the browser + Adobe plugin may still be able to display PDF documents in the browser window itself.

   Returns -3 if you supplied a bad input argument to the isMinVersion( ) method.


PluginDetect.onDetectionDone('AdobeReader', f, DummyPDF): [Returns number]
   This method will initiate plugin detection when needed, and will execute the event handler f after the plugin detection results become available. The event handler f automatically receives the PluginDetect object as an input argument such that we have f(PluginDetect){ ... }. You are free to use the getVersion( ) and isMinVersion( ) methods inside event handler f.
   onDetectionDone( ) can handle both OTF (on the fly) and NOTF (not on the fly) plugin detection. Because NOTF detection may be required for certain cases, you should use the onDetectionDone( ) method to detect AdobeReader. You must specify the DummyPDF input argument in order for NOTF detection to occur.
   Returns 1 if plugin detection is done (OTF) and handler f has been called.
   Returns 0 if plugin detection is not done yet (NOTF) and handler f has not been called yet. Handler f will be called after detection has been completed.
   Returns -1 if error (plugin name input argument not specified correctly).


PluginDetect.getInfo('AdobeReader', DummyPDF): [object or null]
   Returns null if no information is available for this plugin.
   Returns an object with several useful properties. The properties are listed below. To simplify matters, we assign this object to a variable:
    var INFO = PluginDetect.getInfo('AdobeReader', DummyPDF);

INFO.precision: [number]
  Reveals the precision of the detected plugin version.
  Returns 0 if the plugin was not detected.
  Returns 1 if the detected plugin version has the format "A,0,0,0".
  Returns 2 if the detected plugin version has the format "A,B,0,0".
  Returns 3 if the detected plugin version has the format "A,B,C,0".
  Returns 4 if the detected plugin version has the format "A,B,C,D".

INFO.OTF: [number]
   Returns 0 if plugin detection has been performed on the fly (OTF).
   Returns 1 if plugin detection is being performed not on the fly (NOTF) but is not completed yet.
   Returns 2 if plugin detection has been performed not on the fly (NOTF) and is complete.

INFO.DummyPDFused: [Boolean]
   Returns true if the DummyPDF file was loaded/used by the plugin during detection. The DummyPDF was temporarily inserted into the web page as an <object> tag.
   Returns false if the DummyPDF was not loaded/used by the plugin during detection. This occurs when the DummyPDF was not needed to accomplish the detection, or when the plugin is not installed/not enabled in the browser.



Event handler f without user input arguments: If the user does not specify any input arguments for event handler f, then the relevant PluginDetect methods are in the format of
       PluginDetect.onDetectionDone(pluginName, f, ...)
       PluginDetect.onWindowLoaded(f)
       PluginDetect.onBeforeInstantiate(pluginName, f)

When the handler f is executed it automatically receives the PluginDetect object as input such that we have f(PluginDetect){ ... }.

Event handler f with user input arguments: You may specify up to 3 inputs (ie. arg1, arg2, and arg3) for the event handler. The trick is to use an array such as [f, arg1, arg2, arg3]. The relevant PluginDetect methods are in the format of
       PluginDetect.onDetectionDone(pluginName, [f, arg1, arg2, arg3], ...)
       PluginDetect.onWindowLoaded( [f, arg1, arg2, arg3] )
       PluginDetect.onBeforeInstantiate(pluginName, [f, arg1, arg2, arg3])

When the handler f is executed it automatically receives the PluginDetect object as input such that we have f(PluginDetect, arg1, arg2, arg3){ ... }.


minVersion: [string or number input argument]
   This is the minimum plugin 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.

DummyPDF: [string input argument, optional input arg] 
   This is the path/filename to an Adobe PDF document that is temporarily inserted into the web page. It is sometimes used by PluginDetect to improve the precision of the plugin version detection for Internet Explorer. The DummyPDF can only improve the detection precision if Javascript is enabled within Adobe Reader (which it usually is, by default). If you do not specify the DummyPDF, then the plugin version will still be detected for Internet Explorer, but the result may not be quite as precise.
   Using the DummyPDF input argument may, in some cases, cause the detection of Adobe Reader on Internet Explorer to occur much more slowly. If it takes too long for you, then you may want to consider avoiding the use of DummyPDF. The tradoff here is between detection speed and detection precision. More precision may give you slower detection, and less precision may give you faster detection.
   You may download the DummyPDF file here. You are free to rename the DummyPDF file to whatever you wish, as long as the .pdf extension remains the same.
   The path of the DummyPDF can be relative or absolute. If the path is relative, then it is relative to your HTML web page. If your Javascript code is in an external Javascript file, then the path of DummyPDF is NOT relative to the Javascript file - it is still relative to the HTML web page. For example,
           DummyPDF = 'detectAdobe.pdf' means the file is in the same folder as your web page.
           DummyPDF = 'ABC/detectAdobe.pdf' means the file is in a subfolder ABC.

If you specify the DummyPDF path or filename incorrectly, then PluginDetect will be unable to use the DummyPDF. So make sure you get it right. Also, you only need to specify the DummyPDF input argument in the first AdobeReader related PluginDetect command that gets executed. All subsequent PluginDetect commands will automatically remember the value of the DummyPDF input argument. However, you are free to specify DummyPDF in all your PluginDetect commands if you wish.




Limitations of Adobe Reader detection

When you install Adobe Reader on your computer, you have 2 ways of viewing PDF documents:

i) You can use the standalone Adobe Reader application to view PDF documents.

or

ii) You can use a browser with the Adobe Reader plugin to view PDF documents. A PDF document can appear directly inside the browser window, or inside a web page via a <frame> tag/<iframe> tag/<object> tag/<embed> tag.


The problem here is that PluginDetect can only detect the plugin itself. It cannot detect the standalone application. (But the presence of the plugin implies the presence of the standalone)

For example, a user may adjust the Adobe Reader preferences and the browser settings so that the plugin is totally disabled. In this case, PluginDetect will not be able to detect the Adobe Reader plugin, yet the user will still be able to view PDF documents in the standalone application.



There could be multiple PDF Readers in your browser


There are a number of different PDF Reader plugins that can display a pdf document in your browser. To name a few: Adobe Reader, Foxit Reader, Nitro Reader, Chrome viewer (native), PDF.js (native to Firefox), and others.

The problem here is that installing the Adobe Reader on your system is not a guarantee that your browser will automatically use the Adobe plugin when displaying a pdf. For example, your Firefox browser may use PDF.js instead of the Adobe Reader plugin. To insure that your browser actually uses the Adobe plugin, you may have to disable any other PDF readers that are integrated with your browser.

At this point, I am not sure there is a reliable cross-browser/cross-platform way for PluginDetect to determine if the Adobe plugin is the default viewer that will be used by your browser vs. some other random PDF viewer. [However, it does appear to be possible to detect when the PDF.js viewer is the default viewer in Firefox. So any conflict between the Adobe plugin and PDF.js in Firefox can be resolved by detecting PDF.js.]



Plugin Version Precision

The precision of the detected Adobe Reader version will vary greatly between browsers. The reason for this discrepancy is that the amount of information available to PluginDetect varies between browsers and operating systems.

The plugin version is detected by PluginDetect.getVersion('AdobeReader'). The getVersion( ) method will return a value of either null or a string of 4 numbers "A,B,C,D" separated by a comma. Each of these 4 numbers is an integer >=0.

For Internet Explorer, the first 3 numbers "A,B,C" can be detected. For all other browsers, the precision can range from only being able to detect the first number "A", to being able to detect all 4 numbers "A,B,C,D".

The only time (so far) I have seen all 4 numbers "A,B,C,D" available is for Firefox 3.6+ on Windows.



Detecting Reader for Firefox/Chrome/Safari and other non-IE browsers

For Adobe Reader 8.0 thru 9.3 on Windows/non-IE browsers, the plugin version is not directly detectable. PluginDetect can, however, deduce the first digit of the plugin version by looking at all available information within the browser. The format of this deduced version will be "A,0,0,0". [Note: Firefox 3.6+ appears to be the exception. It allows all 4 digits "A,B,C,D" of the plugin version to be detected, regardless of the Adobe Reader version.]

For Adobe Reader < 8.0 and >=5.0, and Adobe Reader 9.3.3 or higher, on Windows/non-IE browsers, the plugin version is detectable. The format of the detected version will be "A,B,C,0".

For Adobe Reader/Macintosh, it appears that the plugin version can be detected as "A,B,C,0" (at least for Reader 7+).

For Adobe Reader/Linux, it appears that the plugin version can be detected as "A,B,0,0".



Select minVersion input argument with care

Please note again that the number of digits that can be detected for the Adobe Reader version will vary. In some cases, the format will be "A,0,0,0", and in others the format will be "A,B,C,D". Therefore, you need to specify the 'minVersion' input argument to PluginDetect.isMinVersion("AdobeReader", minVersion) very carefully.

In the case of Adobe Reader 8 - 9.3 in Windows/non-IE browsers, we have already shown you that the version is only detectable as "A,0,0,0". So, Adobe Reader 8.2 would be detected as "8,0,0,0" and Adobe Reader 8.0 would be detected as "8,0,0,0". Adobe Reader 9.3 would be detected as "9,0,0,0" and Adobe Reader 9.0 would be detected as "9,0,0,0".

So be careful when specifying 'minVersion'.



Detecting Reader for Internet Explorer

For Internet Explorer, the plugin version appears to be detectable for Adobe Reader 5+. The plugin version will have the format of "A,B,C,0".






Top of Page