22/05/12 Java plugin detection with PluginDetect Home Java Plugin Detector Java (using <applet> and/or <object> tag) installed & enabled: true Highest Installed Java Version: 1,6,0,31 Java 1,6,0,10 or higher (using <applet> and/or <object> tag) is installed & enabled. Java detection: completed ON THE FLY (OTF) Deployment Toolkit browser plugin installed & enabled: false Next-Generation Java Plugin2 installed & enabled: true Java vendor: Sun Microsystems Inc. Java plugin name: Java(TM) Platform SE 6 U31 Java plugin description: Next Generation Java Plug-in 1.6.0_31 for Mozilla browsers navigator.javaEnabled(): true [This detector is capable of OTF & NOTF Java detection. Detection occurs before window.onload event has fired.] [window.onload event has fired successfully.] [ The plugin detector(s) in this web page use the following: PluginDetect_Java.js, detectJava_OTF_NOTF.js, getJavaInfo.jar ] Download PluginDetect and the jarfile here... In order to do Java detection, you will need 2 things: 1) download the getJavaInfo.jar applet along with a few Java detection examples. The jarfile (Java ARchive file) is used by PluginDetect in order to accomplish Java detection. 2) download the PluginDetect script itself. The PluginDetect script generator will allow you to customize the PluginDetect script to include whatever features you desire. That being said, I would still recommend that you read thru most of this page before creating your own Java detection code. A brief introduction to Java detection PluginDetect uses a number of different methods when trying to detect Java in your browser. These Java detection methods can be divided into 2 groups: a) the non-applet methods and b) the applet methods. The non-applet detection methods are those techniques that do not use any Java applets to do Java www.pinlady.net/PluginDetect/Java/ 1/28 22/05/12 Java plugin detection with PluginDetect detection. These methods do not require the Java browser plugin to be active. Examples of non-applet methods would be: searching thru the navigator.mimeTypes array for a Java mimetype, searching thru the navigator.plugins array for the Java plugin, trying to instantiate certain ActiveX objects associated with Java, and so on. The applet detection methods are those techniques that instantiate a Java applet(s) in the browser, and then query that applet to get the Java version and vendor. An example of this method would be to insert an <applet> tag into the HTML document, run a Java applet (jar file or class file) in that <applet> tag, and then query the applet to get the installed Java version & vendor. When doing Java detection, PluginDetect will usually try the non-applet methods first. If those methods are unable to find anything, then PluginDetect will try the applet methods. The tradeoffs between the 2 groups of methods are speed, reliability, and timing. The non-applet methods are very fast, which is why they are the first to be used. The applet methods, on the other hand, are more reliable but relatively slow. The applet methods force the Java plugin to run. And that way you know for sure whether the plugin is installed and enabled in your browser. As to the issue of timing, we can say that Java detection is performed either "on the fly" (OTF) or "not on the fly" (NOTF) in your script. Any single line of Javascript code that is able to both initiate and complete Java detection is said to be OTF. No Javascript code is executed by the browser in between the initiation and the completion of the Java detection. All non-applet methods are performed OTF. And usually, the applet methods are OTF as well. [BTW, all non-Java plugins detected by PluginDetect are OTF.] For NOTF detection, the browser is able to execute Javascript code in between the initiation and the completion of Java detection. In other words, after you initiate detection the browser will keep executing Javascript commands while you are waiting for the Java results. NOTF Java detection only occurs for the applet methods, and only some of the time. Finally, PluginDetect allows some flexibility in how it accomplishes Java plugin detection. You can tell PluginDetect to only use the non-applet methods. Or, you can tell it to only use the applet methods. Or, you can specify some combination thereof. A list of PluginDetect commands for Java detection The PluginDetect commands for Java detection are as follows: PluginDetect.getVersion('Java', jarfile, verifyTagsArray): [Returns string or null] Returns the version (as a string) of the installed plugin. If multiple Java versions are detected, then the highest installed version is returned. When getVersion() returns a version, it only means that Java is installed. It does NOT necessarily mean that Java 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: www.pinlady.net/PluginDetect/Java/ 2/28 22/05/12 Java plugin detection with PluginDetect PluginDetect.getVersion(delimiter) where delimiter is a string with exactly 1 character. For example, PluginDetect.getVersion("."); // set delimiter var version = PluginDetect.getVersion("Java", jarfile, verifyTagsArray); // version has the format of "A.B.C.D" PluginDetect.isMinVersion('Java', minVersion, jarfile, verifyTagsArray): [Returns number] Returns 1 if plugin is installed (& enabled) and plugin version is >= minVersion. The <applet> and/or <object> tag can be used to run a Java applet. Returns 0.5 if plugin detection has been initiated but is not yet completed. The +0.5 number only occurs for NOTF detection. The plugin appears to be installed (& enabled). Other Java info may or may not be available at this point in time. You will have to wait until detection has completed to get all the detection info. When the plugin detection has been completed, the isMinVersion() method will return a different number. Returns 0 if plugin installed (& enabled). The plugin version is unknown, and thus we are unable to determine if version >= minVersion. Returns -0.1 if plugin is installed & enabled, but plugin version is < minVersion. Returns -0.2 if Java installed but not enabled. Some browsers occasionally reveal enough info to make this determination. Returns -0.5 if plugin detection has been initiated but is not yet completed. The -0.5 number only occurs for NOTF detection. It is not known yet whether the plugin is installed or what the plugin version is. When the plugin detection has been completed, the isMinVersion() method will return a different number. Returns -1 if plugin is not installed or not enabled. Returns -3 if you supplied a bad input argument to the isMinVersion() method. PluginDetect.onDetectionDone('Java', f, jarfile, verifyTagsArray): [Returns number] This method is used for any plugin that requires both OTF and NOTF detection. The method will initiate plugin detection if 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){ ... }. This method is useful as sometimes Java detection results are available at unpredictable times - meaning that Java detection is not always possible "on the fly". Hence, the onDetectionDone() method will wait as long as necessary until the Java detection has completed before executing handler f. You are free to use getVersion() and isMinVersion() inside handler f to see the detection results. Returns 1 if plugin detection is done (OTF) and handler f has been executed. Returns 0 if plugin detection is not done yet (NOTF) and so handler f has not been executed yet. Returns -1 if error (plugin name input argument not specified correctly). PluginDetect.beforeInstantiate('Java', f): Executes the event handler f immediately before PluginDetect attempts to instantiate the plugin. [By instantiate, we mean that an instance of the plugin is inserted into your web page. This will cause the plugin to start up and run, assuming it is installed.] The event handler automatically receives the PluginDetect object as an input argument such that we have f(PluginDetect){ ... }. Sometimes during detection, it may be necessary for PluginDetect to instantiate (or attempt to instantiate) the plugin. Should this attempt be neccessary, the event handler f will run first, and then the plugin will attempt to instantiate. [Note: If the plugin is installed and enabled, then it instantiates. If it is not installed or not enabled, then it will not instantiate. Either way, the handler f will run before the attempt is made.] In order for the beforeInstantiate() method to work correctly, you must place it BEFORE detection is started for the plugin. In other words, use it before getVersion(pluginName), isMinVersion(pluginName), and www.pinlady.net/PluginDetect/Java/ 3/28 22/05/12 Java plugin detection with PluginDetect onDetectionDone(pluginName). As an example: var PD = PluginDetect; var F1 = function($){ ... }; // $ input arg is the PluginDetect object PD.beforeInstantiate('Java', F1); var F2 = function($){ var version = $.getVersion('Java'); alert(version); }; PD.onDetectionDone('Java', F2, 'getJavaInfo.jar'); PluginDetect.onWindowLoaded( f ): Executes the event handler f after the browser window has fully loaded, and after the plugin detection results are 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 getVersion(), isMinVersion(), onDetectionDone(), and beforeInstantiate() inside event handler f. 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.beforeInstantiate(pluginName, f) When the handler f is executed it automatically receives the PluginDetect object as input such that we have f(PluginDetect){ ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages28 Page
-
File Size-