java plugin targeting through javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mark

    java plugin targeting through javascript

    Adding an applet to a web page through the <object> tag, allows you to
    target the JVM in 2 ways.

    (ref. http://java.sun.com/products/plugin/versions.html )

    1. "Dynamic Versioning", which basically means "run with version X or
    greater".
    2. "Static Versioning", which targets a very specific version, e.g.
    1.3.1_06.

    Sadly, the reality for developers is neither. Usually an application
    is developed/tested for a specific range of versions, e.g. 1.3.1_02 ->
    1.3.1_07.

    I thought I might be able to use some JavaScript trick to iterate
    through a few "Static Versioned" values, and stop when a successful
    applet initialization took place.

    I don't really do much JavaScripting so I have been unsuccessful. Any
    help is appreceated. Here is an example first attempt (minus
    irrelevent stuff) so you know I'm not completely lazy:


    <html>
    <head>
    <title>Plugin Target Test</title>
    <script type="text/javascript">



    function tryV(version)
    {
    document.write( 'trying ' + version + '<br>');

    for (i=0; i<version; i++) //has an earlier version worked?
    {

    if(document.get ElementById("ve rsion" + i)!=null) // NOTE: this
    doesn't really do what I want, but the idea is there
    return;
    }




    //classid value targets Java 1.3.1_0[version]
    document.write( '<OBJECT id="version' + version + '" classid =
    "clsid:CAFE EFAC-0013-0001-000' + version + '-ABCDEFFEDCBA" ');
    //document.write( ' codebase =
    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Versio n=1,4,2,0"
    ');
    document.write( ' WIDTH = 100% HEIGHT = 100% NAME = "Applet"
    ALIGN = center > ');
    document.write( ' <PARAM NAME = CODE VALUE = "com.foo.Ba r" > ');
    document.write( ' <PARAM NAME = ARCHIVE VALUE = " ');
    document.write( ' jar1.jar, jar2.jar" ');
    document.write( ' <PARAM NAME = NAME VALUE = "Applet" > ');
    document.write( ' <PARAM NAME = "type" VALUE =
    "applicatio n/x-java-applet;jpi-version=1.3"> ');
    document.write( ' <PARAM NAME = "scriptable " VALUE = "false"> ');
    document.write( ' <PARAM NAME = "PROPERTIES "
    VALUE="applet.p roperties"> ');
    document.write( version + 'no good<br> ');
    document.write( ' </OBJECT>');

    }

    </script>
    </head>
    <body>

    <!--"CONVERTED_APPL ET"-->
    <!-- HTML CONVERTER -->
    <script type="text/javascript">

    //try some acceptable values
    tryV(3);
    tryV(4);
    tryV(5);
    tryV(6);

    </script>
    </body>
    </html>
  • Nobody

    #2
    Re: java plugin targeting through javascript


    "mark" <z5h@hotmail.co m> wrote in message
    news:fe341124.0 309040501.3f233 640@posting.goo gle.com...
    | Adding an applet to a web page through the <object> tag, allows you to
    | target the JVM in 2 ways.
    |
    | (ref. http://java.sun.com/products/plugin/versions.html )
    |
    | 1. "Dynamic Versioning", which basically means "run with version X or
    | greater".
    | 2. "Static Versioning", which targets a very specific version, e.g.
    | 1.3.1_06.
    |
    | Sadly, the reality for developers is neither. Usually an application
    | is developed/tested for a specific range of versions, e.g. 1.3.1_02 ->
    | 1.3.1_07.

    I thought you could get the JVM version from the various browser's object
    models. I know you can use VBScript in IE to create Java objects of a
    specific version and have seen scripts that iterate until they hit one that
    returns an object. Not sure how to do it in JS though.

    |
    | I thought I might be able to use some JavaScript trick to iterate
    | through a few "Static Versioned" values, and stop when a successful
    | applet initialization took place.
    |
    | I don't really do much JavaScripting so I have been unsuccessful. Any
    | help is appreceated. Here is an example first attempt (minus
    | irrelevent stuff) so you know I'm not completely lazy:
    |
    |
    | <html>
    | <head>
    | <title>Plugin Target Test</title>
    | <script type="text/javascript">
    |
    |
    |
    | function tryV(version)
    | {
    | document.write( 'trying ' + version + '<br>');
    |
    | for (i=0; i<version; i++) //has an earlier version worked?
    | {
    |
    | if(document.get ElementById("ve rsion" + i)!=null) // NOTE: this
    | doesn't really do what I want, but the idea is there
    | return;
    | }
    |
    |
    |
    |
    | //classid value targets Java 1.3.1_0[version]
    | document.write( '<OBJECT id="version' + version + '" classid =
    | "clsid:CAFE EFAC-0013-0001-000' + version + '-ABCDEFFEDCBA" ');
    | //document.write( ' codebase =
    |
    "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#
    Version=1,4,2,0 "
    | ');
    | document.write( ' WIDTH = 100% HEIGHT = 100% NAME = "Applet"
    | ALIGN = center > ');
    | document.write( ' <PARAM NAME = CODE VALUE = "com.foo.Ba r" > ');
    | document.write( ' <PARAM NAME = ARCHIVE VALUE = " ');
    | document.write( ' jar1.jar, jar2.jar" ');
    | document.write( ' <PARAM NAME = NAME VALUE = "Applet" > ');
    | document.write( ' <PARAM NAME = "type" VALUE =
    | "applicatio n/x-java-applet;jpi-version=1.3"> ');
    | document.write( ' <PARAM NAME = "scriptable " VALUE = "false"> ');
    | document.write( ' <PARAM NAME = "PROPERTIES "
    | VALUE="applet.p roperties"> ');
    | document.write( version + 'no good<br> ');
    | document.write( ' </OBJECT>');
    |
    | }
    |
    | </script>
    | </head>
    | <body>
    |
    | <!--"CONVERTED_APPL ET"-->
    | <!-- HTML CONVERTER -->
    | <script type="text/javascript">
    |
    | //try some acceptable values
    | tryV(3);
    | tryV(4);
    | tryV(5);
    | tryV(6);
    |
    | </script>
    | </body>
    | </html>


    Comment

    Working...