Question

I have created an applet; it is deployed using the Deployment Toolkit as below (the URLs are fake):

<script type="text/javascript" 
             src="https://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {
        code:'br.com.brandizzi.adam.applet.MyApplet.class',
        archive:'http://adam.brandizzi.com.br/html/applet.jar',
        width : 50,
        height : 1
    };
    var parameters = {
        fontSize : 1,
    };
    var version = '1.6';
    deployJava.runApplet(attributes, parameters, version);
</script>

It works well. Luckily, however, I reached my site through a machine without JVM and it was always redirected to http://www.java.com - as the documentation states:

If the client does not have the required minimum version of the JRE software, the Deployment Toolkit script redirects the browser to http://www.java.com to allow users to download the latest JRE software. On some platforms, users might be redirected before they can view the web page containing the applet.

Is there a way to avoid this redirect? The page can work great without JVM, the applet is just a little improvement. Anyway, our users can become very confused with this redirect and they not even have permissions to install JVM.

Was it helpful?

Solution 2

The whole point of using the Deployment Toolkit is that it prompts the user to install a JVM if they don't have one, so that your applet can run. If you don't want them to be prompted, then simply don't use the Deployment Toolkit.

If they have a suitable JVM installed already then your applet will run. If not, the remainder of the page should load normally.

OTHER TIPS

If you take a look at the deployJava.js script and the runApplet function is says:

     /**
     * Ensures that an appropriate JRE is installed and then runs an applet.
     * minimumVersion is of the form #[.#[.#[_#]]], and is the minimum
     * JRE version necessary to run this applet.  minimumVersion is optional,
     * defaulting to the value "1.1" (which matches any JRE).
     * If an equal or greater JRE is detected, runApplet() will call
     * writeAppletTag(attributes, parameters) to output the applet tag,
     * otherwise it will call installJRE(minimumVersion + '+').

So if you make the call like this

deployJava.runApplet(attributes, parameters, null);

or like this

deployJava.runApplet(attributes, parameters, 'undefined');

or like this

deployJava.runApplet(attributes, parameters, '1.1');

it will only check if Java is installed at all, and only then redirect to java.com for installation. And since you have an applet, you do need Java :)

Alternatively you can call deployJava.writeAppletTag(attributes, parameters) directy:

    /**
     * Outputs an applet tag with the specified attributes and parameters, where
     * both attributes and parameters are associative arrays.  Each key/value
     * pair in attributes becomes an attribute of the applet tag itself, while
     * key/value pairs in parameters become <PARAM> tags.  No version checking
     * or other special behaviors are performed; the tag is simply written to
     * the page using document.writeln().
     *
     * As document.writeln() is generally only safe to use while the page is
     * being rendered, you should never call this function after the page
     * has been completed.
     */

You can use getJREs function from deployJava.js.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top