Detecting java plugin using javascript

Hello,
actually I'm neither new to java (but I didn't find a more appropriate forum here) nor my question directly refers to java, instead it concerns javascript:
I'm looking for a way to detect (inside an html-page) if the java plugin is installed (using javascript). What I don't need/want:
- Start/use a java applet to check for it (or embed some <object...>-stuff, that probably makes the vm start or opens some dialog automatically)
- use navigator.javaEnabled() (this merely tells you about the browser settings, not if the plugin is actually installed
I've already found navigator.plugins to be useful, but this only works on firefox, mozilla etc, but not on IE or Opera.
Any information or link etc. would be appreciated.
Thanks.

I would like to have some script detecting any version of the java plugin (older versions as well).
Anyway, if you only have a solution for newer versions or some vbscript creating an object... well, I would appreciate if you share it, too. Any help would be just fine :)
P.S.: About the jws-code you mentioned: I'm new to VBScript. I found something similar I think, but it returns nothing:
<script>
function checkPlugin(){
var r = detectIE("8AD9C840-044E-11D1-B3E9-00805F499D93","java");
alert("RESULT = " + r);
function detectIE(ClassID,name){
result = false;
alert(ClassID);
document.writeln('<script language="VBscript">');
document.writeln('\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))');
document.writeln('msgbox(IsObject(CreateObject("' + ClassID + '")))');
document.writeln('</scr' + 'ipt>');
if (result)
return name+',';
else return '';
</script>Isn't that the way it's supposed to work (the vb is encapsulated to prevent some error messages on the mac, I think)? The classid should be correct, according to the registry.... So, how to do it?

Similar Messages

  • ANSWER: HOW TO DETECT Java Plugin from JavaScript

    I created a new topic because the questions about
    how to detect Java Plugin in browsers are scattered
    thoughout this forum.
    Basically you need to employ two approaches for IE and NS.
    In IE you need to try to instantiate a small applet
    (not your production applet) in order to see if browser
    can do it. if the browser can do it, you can make a
    call applet from JavaScript in order to find version of
    JRE (as well as a host of other things).
    In NS you can write a simple JavaScript which will
    interrogate the browser for all plugins installed. Then
    ypu can make a desicion whether to pass execution to
    the next(or generated) page which hosts your applet,
    or ask the user to download/install a plugin.
    I ecourage everybody to host a plugin on your site
    rather leave default link to it which is generated by
    html converter.
    In order to run sample,
    Prerequisites:
    Java Plugin 1.3.
    If you have a different version of plugin,
    substitute hardcoded plugin version in JavaScript for
    value that you have.
    1. compile java file
    2. put class file in the same directory with html file
    3. load html file into the browser.
    4. press "Check Java Plugin.." button
    5. see it work
    6. examine code
    7. uninstall plugin
    8. repeat steps 1 - 4
    9. see it work
    10. install plugin.
    Sample code follows:
    **********************HTML FILE BEGIN***********
    <HTML>
    <HEAD>
    <!-- Generated by Kawa IDE -->
    <TITLE>Detect Java Runtime</TITLE>
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    var browsername;
    function doNetscape()
    for (i=0; i < navigator.plugins.length; i++)
    for (j = 0; j < navigator.plugins.length; j++)
    if(navigator.plugins[i][j].type == "application/x-java-applet;version=1.3")
    alert("You are running Netscape with Java Plugin 1.3.0 - OK");
    return;
    alert("You are running Netscape\nPlease, install Java Runtime Environment 1.3.0");
    function doMicrosoft()
    var applet = document.myApplet;
    if(applet == null)
    alert("You are running Microsoft Browser.\nPlease, install Java Runtime Environment 1.3.0");
    return;
    var version = applet.getJavaVersion();
    if(version == "1.3.0")
    alert("You are running IE, Java Plugin 1.3.0 installed - OK");
    else
    alert("You are running IE, other plugin installed - mybe OK if later that 1.3.0\nYour version: " + version);
    function getJava()
    var applet = document.myApplet;
    if(applet == null)
    alert("Please, install Java Runtime Environment");
    return;
         alert("JRE Version: " + document.myApplet.getJavaVersion());
    function checkJavaPlugin()
         browsername = navigator.appName;
         if(browsername.indexOf("Netscape")!= -1)
              browsername="NS";
              doNetscape();
         else
              if(browsername.indexOf("Microsoft")!=-1)
                   browsername="MSIE";
                   doMicrosoft();
              else
                   browsername="N/A";
                   alert("Unknown browser: " + browsername);
    </SCRIPT>
    <body>
    <Strong>Check Java Plugin</strong>
    <OBJECT id="myApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
         WIDTH = 1
         HEIGHT = 1 >
         <PARAM NAME = CODE VALUE = "DetectPluginApplet.class" >
         <PARAM NAME="scriptable" VALUE="true" >
         <embed type="application/x-java-applet;version=1.3"
              code = DetectPluginApplet width = 2 height = 2 MAYSCRIPT = "true" >
         </embed>
         </EMBED>
    </object>
    <FORM>
         <INPUT TYPE="button" value="Get Plugin Version in IE" onClick="getJava()">
         <INPUT TYPE="button" value="Check Java Plugin in NS and IE" onClick="javascript:checkJavaPlugin()">
    </FORM>
    </BODY>
    </HTML>
    **********************HTML FILE END***********
    ***************APPLET FILE BEGIN***********
    import java.awt.*;
    public class DetectPluginApplet extends java.applet.Applet
         public void init()
              add(new Label("DetectPluginApplet"));
    public String getJavaVersion()
    return System.getProperty("java.version");
    **************APPLLET FILE END************

    Try following java script, it works on new browsers (NS 4+, IE5+). For IE you have to enable 'ActiveX objects creation' in security options.
    var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
    && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
    && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0") !=-1));
    var is_ie5up = (is_ie && (is_major == 4)
    && ( (agt.indexOf("msie 5.0")!=-1)
    || (agt.indexOf("msie 5.5")!=-1)
    || (agt.indexOf("msie 6.0")!=-1) ) );
    var pluginDetected = false;
    var activeXDisabled = false;
    // we can check for plugin existence only when browser is 'is_ie5up' or 'is_nav4up'
    if(is_nav4up) {
    // Refresh 'navigator.plugins' to get newly installed plugins.
    // Use 'navigator.plugins.refresh(false)' to refresh plugins
    // without refreshing open documents (browser windows)
    if(navigator.plugins) {
    navigator.plugins.refresh(false);
    // check for Java plugin in installed plugins
    if(navigator.mimeTypes) {
    for (i=0; i < navigator.mimeTypes.length; i++) {
    if( (navigator.mimeTypes[ i].type != null)
    && (navigator.mimeTypes[ i].type.indexOf(
    "application/x-java-applet;jpi-version=1.3") != -1) ) {
    pluginDetected = true;
    break;
    } else if (is_ie5up) {
    var javaVersion;
    var shell;
    try {
    // Create WSH(WindowsScriptHost) shell, available on Windows only
    shell = new ActiveXObject("WScript.Shell");
    if (shell != null) {
    // Read JRE version from Window Registry
    try {
    javaVersion = shell.regRead("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment\\CurrentVersion");
    } catch(e) {
    // handle exceptions raised by 'shell.regRead(...)' here
    // so that the outer try-catch block would receive only
    // exceptions raised by 'shell = new ActiveXObject(...)'
    } catch(e) {
    // Creating ActiveX controls thru script is disabled
    // in InternetExplorer security options
    // To enable it:
    // a. Go to the 'Tools --> Internet Options' menu
    // b. Select the 'Security' tab
    // c. Select zone (Internet/Intranet)
    // d. Click the 'Custom Level..' button which will display the
    // 'Security Settings' window.
    // e. Enable the option 'Initialize and script ActiveX controls
    // not marked as safe'
    activeXDisabled = true;
    // Check whether we got required (1.3+) Java Plugin
    if ( (javaVersion != null) && (javaVersion.indexOf("1.3") != -1) ) {
    pluginDetected = true;
    if (pluginDetected) {
    // show applet page
    } else if (confirm("Java Plugin 1.3+ not found, Do you want to download it?")) {
    // show install page
    } else {
    // show error page
    }

  • Detecting Java Version using Javascript??

    Hi,
    This is a Javascript & Java question really. The problem i have is i want to detect what version of Java a user has.
    So using Javascript i can find if java is enabled like so:
    navigator.javaEnabled();
    but i want to know what version as well.
    I tried:
    var version = java.lang.System.getProperty("java.version");
    but had not luck. does anyone know if this is possible and if so how?
    thanks,
    Chris.

    Because Sun chooses to use a weird format for their version numbers, and since Internet Explorer uses ActiveX objects instead of normal plug-ins, you'd have to write a script that could skim through the Windows registry to dig up what the latest version of the Java Plug-in is.
    Scanning through the registry isn't a problem, so much as the non-conventional versioning system that Sun has in place. With Netscape, Opera, and other non-ActiveX browsers, it's a piece of cake.

  • Detecting Java Plugin version in IE

    I need to be able to detect the version of the plug-in that is installed in IE. Basically, I want to use an Object tag to load Java 2 in a web browser, but if it's not a compliant version (1.3 version) send the person to an upgrade site. Is this possible using VB/javascript? What is the registered name of the activeX java plugin component?

    While you probably can make some script to determine
    the version of the plug-in, you don't really need to.
    In your HTML, use the OBJECT tags to specify what
    version of the plug-in you require and include the
    URL to redirect to if they do not have it - see
    http://java.sun.com/j2se/1.4.1/docs/guide/plugin/devel
    per_guide/using_tags.html and
    http://java.sun.com/products/plugin/versions.html
    I know about doing this as part of the OBJECT tag. The trouble is that I do not want Ie or the plug-in to try to do the automatic upgrade, and I'd like to be able to redirect the user to my own set of pages describing how to upgrade

  • Firefox is not detecting Java plugin

    A few weeks ago I installed updates and updated to Firefox 3.6.13 on OpenSuse 11.1 (yeah, I know, I should upgrade, but I'm lazy). No more Java functionality for me. So I installed a new version. I followed all of the instructions on this page (I've tried both from the RPM and the self-extracting file and get the same results either way): http://java.com/en/download/help/linux_install.xml but I got nothing. Next I tried this: http://www.oracle.com/technetwork/java/javase/manual-plugin-install-linux-136395.html The /firefox/plugins folder (which I should note I have installed in my home directory) shows the symbolic link. Still not registering in Firefox, at all. When I go to about:plugins, I'm not seeing anything about JRE.
    At this point I'm at a loss. I'm ashamed to admit that as long as I've been using Linux, I still know very little about it as I only use the very basic functions on my machine (email, internet, office applications; no need for much other than that). But I've never run up against this problem before, and I'm not sure what I'm missing here about what I did wrong. I have this sneaking suspicion it's something simple, but...
    thanks!

    Make sure that you create a symlink to the Java JP2 plugin (libnpjp2.so) that current Firefox version need.
    *http://www.oracle.com/technetwork/java/javase/manual-plugin-install-linux-136395.html
    * http://kb.mozillazine.org/Determining_plugin_directory_on_Linux
    <pre><nowiki>ln -s /usr/lib/jvm/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/libnpjp2.so (java-1_6_0-sun-plugin)
    </nowiki></pre>
    OpenSUSE 11.1 has reached end of live, so you won't be getting any updates as you probably noticed.
    *http://en.opensuse.org/Lifetime

  • How does one use JavaScript with the Windows Media Player Plugin?

    Hi there.
    According to this old [http://msdn.microsoft.com/en-us/library/dd564570%28v=VS.85%29.aspx MSDN Article] it is possible to control the windows media player plugin using javascript.
    It provides a series of objects off the object that should perform certain funtions, such as play stop and seek.
    It states very clearly in the article that some are not supported; however, none of them seem to be working with the latest version(s?) of Firefox.
    I have Firefox 5 installed currently and have not tested in any other version, so I'm not sure when it stopped working.
    The video does load and will display properly -- the ability to control it through javascript however, does not work.
    i.e.:
    var mplay = document.getElementById('myplayer');
    mplay.controls.play(); // mplay.controls is undefined
    This same code works in Internet Explorer.

    You need to place the URL in a data attribute for Firefox.
    <pre><nowiki>document.write(' <OBJECT id="Player" data="http://87.117.197.189:16229" width="320" height="45" type="application/x-ms-wmp">');
    document.write(' <param name="AudioStream" value="true">');
    document.write(' <param name="Enabled" value="True">');
    document.write(' <param name="ClickToPlay" value="false">');
    document.write(' <param name="BufferingTime" value="5">');
    document.write(' <param name="ShowDisplay" value="False">');
    document.write(' <param name="Volume" value="70">');
    document.write(' <param name="autoStart" value="true">');
    document.write(' </OBJECT>');</nowiki></pre>

  • Java Plugin Detection using VBScript on Internet Explorer

    Hi,
    I need a way to detect when the plugin version is above a certain version number (such as 1.4.1 or higher) so that I can give the user some extra info as to what is happening when the plugin is downloading automatically on Internet Explorer. Something like :-
    "Please wait for Java plugin to download"
    At present there is a long delay when the user may not know what is happening as no info is relayed back to user.
    I know that the presence of the plugin can be detected using vbscript but not with JavaScript but how do i determine that the user has 1.4.1 or higher. I use the following code:
    <script language="vbscript">
    If IsObject(CreateObject("JavaPlugin"))=True Then
    document.writeln("some info to user")
    End If
    </script>
    This tells me if a JavaPlugin is installed but not what version so we still dont know whether the applet will run or the plugin will download.
    I have also tried:
    <script language="vbscript">
    If IsObject(CreateObject("JavaPlugin.141"))=True Then
    document.writeln("some info to user")
    End If
    </script>
    this works but what if the user already has a version greater than 1.4.1 this is not detected and a nonsense message saying that the Java plugin is downloading is displayed.
    Any ideas?

    Here's JavaPlugin detection for netscape and ie using JavaScript . . .
    Throw this in a .js file and source it at the start of you html.
    function detectPlugin() {         
         var thePlugins = detectPlugin.arguments;     // allow for multiple checks in a single pass
         var pluginFound = false;               // consider pluginFound to be false until proven true
         // if plugins array is there and not fake
         if (navigator.plugins && navigator.plugins.length > 0) {
    var pluginsArrayLength = navigator.plugins.length;     
              // for each plugin loop through all desired names and check each against the current plugin name
    for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
    var numFound = 0;
    for(namesCounter=0; namesCounter < thePlugins.length; namesCounter++) {
                        // if desired plugin name is found in either plugin name or description     the pluginFound                     
    if( (navigator.plugins[pluginsArrayCounter].name.indexOf(thePlugins[namesCounter]) >= 0) || (navigator.plugins[pluginsArrayCounter].description.indexOf(thePlugins[namesCounter]) >= 0) ) {
    numFound++;
                   // now that we have checked all the required names against this one plugin,
                   // if the number we found matches the total number provided then we were successful
    if(numFound == thePlugins.length) {
    pluginFound = true;
                        // if we've found the plugin, we can stop looking through at the rest of the plugins
    break;
    return pluginFound;
    function noJavaPlugin(){
    window.open("http://plugin_location");
    function redirect_users(URL){
    location.href = URL;
    if(navigator){
    browser_string = navigator.appVersion + " " + navigator.userAgent;
    if (browser_string.indexOf("MSIE")>=0) {
              document.write(' <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"');
              document.write(' CODEBASE="javascript:noJavaPlugin()" width=1 height=1>');
              document.write(' <param name="type" value="application/x-java-applet;version=1.4">');
              document.write(' <param name="cache_option" value="Plugin">');
              document.write(' <param name="cache_archive" value="">');
              document.write(' <param name="MAYSCRIPT" value="true">');
              document.write(' </object>');
         else {
              if (! (detectPlugin("Java Plug-in 1.4.0_01 for Netscape Navigator (DLL Helper)"))) {
                   noJavaPlugin();
    else{
         noJavaPlugin();
    redirect_users("http://place_to_go_if_they_have_plugin");

  • Detect and install java runtime environment using javascript

    hi, i'm a flash developer and i only use javascript to embed my movies in html, i've search the web and found some answers but i can't seem to understand it very well maybe because i don't have that much time to learn it. please if you have any script that can detect JRE and install it if it's not installed share it to me. that would be a great help. thanks in advance. :D

    But it is to do with Java and some people here may
    know the answer. I don't know the answer but I would
    like to.Yes some might know the answer, but I think you will find the answer faster if you google, or ask in a javascript forum.

  • Is there a way for a developer to detect if the Java plugin was blocked?

    For best UX in my web application I'd like to know if Java has been blocked because of security vulnerabilities.
    If it's been blocked I'd like to show m own message that Java is out of date and they should update.
    I don't want to show it everytime Java is out of date since it's only important for me and the user if there are security vulnerabilities. If Java version is not known to have vulnerablities I don't want my users to be disturbed by additional messages or steps reguired to update Java.
    Is there a way to detect using Javascript if Firefox blocked a plugin because of security vulnerability?

    Thanks for the reply.
    I have already seen this page but my applet doesn't have a visible area. It's just for communication with external devices and it interacts with Javascript. In my case it doesn't look like in the link.
    Fortunately in new version of Firefox a large modal appears with option to update Java which is quite OK. I am only affraid that if there are no new versions of Java Firefox will display this small dropdown in the top left hand corner which our users tend to miss.

  • Using javascript to detect JVM

    Hi all.
    I'm trying to use javascript to detect whether the JVM (either j2sdk or j2ee) has been installed and take the user to SUN web page if not.
    The original MS JVM is not useable for my purposes (does anyone use it?).
    I know how to detect browsers and plug-ins but not JVM.
    Can anyone help out please ?
    TIA :-)

    If you use the classid and codebase attributes of the <object and <embed tags, it will download automatically. Easiest is to use HTMLConverter. You can change codebase to point to somewhere on your network if not everyone has internet access. See [url http://java.sun.com/j2se/1.4.1/docs/guide/plugin/developer_guide/using_tags.html]here

  • Detecting the JVM version using Javascript in IE

    Where can I find the neccessary code to detect the existance and version of the JRE/JVM installed on a client machine. I'm looking for something like this:
    http://java.sun.com/j2se/jre_check/index.jsp
    I'm not a Java programmer, I don't know how to compile a class file. Can someone help? Thanks.

    What you reference is a JavaServerPage served from a server. It doesn't use Javascript.
    You don't give much information; take a look at these search hits and see if anything listed is what you're after. Some of the threads include Javascript code. (But I'm not very knowledgble of its details.) If not, post back with details, maybe someone then would be able to answer.

  • I am trying to use screens and it keeps telling me it cannot detect Java even though I have installed and updated Java?  What might be the problem?

    I am trying to use "screenr" and it keeps telling me it cannot detect Java even though I have downloaded and updated Java?  What is going on or what might I do to correct this?
    Thanks

    Firefox needs 32-bit plugins, so you'll need to install 32-bit Java for Firefox.
    No, you can't change Firefox from 32-bt to 64-bit. There is a Nightly 64-bit version (alpha) of Firefox, but it is used only to test for regressions until development is resumed.

  • JavaScript to Java with the Java Plugin, anyone?

    The java.sun.com web site seems to be teeming with docs on how to access JavaScript from Java, and the Netscape site seems to have plenty of docs on how to access Java methods from JavaScript using the browser's own JRE.
    But can one use JavaScript to access methods of a Java applet running under the Java Plugin? And if so, how?

    all the public methods and fields of an applet are exposed to javascript. In the <applet> tag, set...
    <applet ...otherinfo... mayscript></applet>, or
    <applet ...otherinfo... mayscript="true"></applet>
    I think the latter version is safer to use, as I think IE has issues if you just use the mayscript tag without the "true" value.
    So if that is set, in javascript all you have to do is address the applet, and call any of its public fields/methods. (Actually, I know you can call all public methods and I think you can call all the public fields as well...)
    var applet = self.document.applets[0];So now you can call all the public members, such as...
    applet.start();
    applet.stop();
    applet.myPublicFn1();
    applet.myPublicFn2(arg1, arg2);
    var val = applet.pubField1;etc.
    Note that if you're using Java2 (swing) thru the object/embed tags rather than just using the applet tag, things don't work that smoothly. I tried once and the applet wasn't actually found in the applets collection of the document. I tried finding the 'applet' object but had no such luck...
    Hope that helps.
    Good luck.

  • Javascript to applet calls with Java Plugin

    Hello,
    I'm working on getting existing applets to work with Sun's Java Plugin (v 1.3.1_03). I'm not sure how to modify calls to the applet from JavaScript. For example:
    document.applets[0].getClientHomeFromEnvironment();
    This works fine using the regular browser VM in IE or Netscape, but is not valid when using Sun's Plugin. I found the following in the Developer FAQ:
    Q: Does Java Plug-in support Java-JavaScript communication?
    A: Yes, Java Plug-in supports basic, bidirectional Java-JavaScript communication. The following, however, is a known incompatibility.
    In the Microsoft implementation, applet methods and properties exposed in JavaScript are exactly the same as the methods and fields in the applet object. In Java Plug-in, an applet's methods and properties are exposed in JavaScript through JavaBeansTM introspection, which treats the applet's fields in a different manner than the Microsoft VM. Therefore, JavaScript accessing fields in an applet object may not work the same when run on JRE/Java Plug-in.
    But it's still not clear to me how I would go about calling the applet. Has anyone done this successfully?
    Thanks,
    -Dave Meier.

    Yes and no....
    I'm using the internal browser JVM when the user has NS < 6.0 and IE < 5.0. But.. if they have NS 6.0+ or IE 5.0+ and have the browser configured properly, it hands off to the plugin. That does work.
    If you must use the OBJECT or EMBED tags... Your best bet are the release notes for the plugin to see what they say about Java-JavaScript support. You could start here...
    http://java.sun.com/products/plugin/1.3/enhancements/oji.html
    JZ

  • Detecting version using javascript or vbscript

    How may I detect JRE version through Javascript or VBScript?

    Because Sun chooses to use a weird format for their version numbers, and since Internet Explorer uses ActiveX objects instead of normal plug-ins, you'd have to write a script that could skim through the Windows registry to dig up what the latest version of the Java Plug-in is.
    Scanning through the registry isn't a problem, so much as the non-conventional versioning system that Sun has in place. With Netscape, Opera, and other non-ActiveX browsers, it's a piece of cake.

Maybe you are looking for