auto-install script hangs Internet Explorer 7

Discussion in 'Javascript' started by Anil, Jan 24, 2007.

  1. Anil

    Anil Guest

    I want to bring to your attention the Javascript code in the article
    http://java.sun.com/developer/technicalArticles/JavaLP/javawebstart/AutoInstall.html
    It breaks in IE7.0.
    The browser hangs and has to shut down.
    I would appreciate any help.
    thanks,
    Anil

    ----------------------------------------------

    <script language="javascript"><!---
    var detect = navigator.userAgent.toLowerCase();
    var windowsIE = (checkPlatform("msie") && checkPlatform("win"));
    var launchTID;

    var thisLocation =
    location.href.substring(0,location.href.lastIndexOf('/')+1);


    function launchApp() {
    if (windowsIE) {
    document.write("<OBJECT

    CODEBASE=http://java.sun.com/update/1.5.0/jinstall-1_5_0_09-windows-i586.cab

    CLASSID=clsid:5852F5ED-8BF4-11D4-A245-0080C6F74284 HEIGHT=0
    WIDTH=0>");
    document.write("<PARAM NAME=app VALUE=" + thisLocation +

    "juwoDemos_files/juwo.jnlp>");

    document.write("<PARAM NAME=back VALUE=true>");
    document.write("</OBJECT>");
    } else {
    if (navigator.mimeTypes && navigator.mimeTypes.length) {
    if (!webstartVersionCheck("1.5")) {
    // Java Web Start not installed; open browser window to install site

    window.open("http://jdl.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=java.com",

    "needdownload");
    }
    // Spin quietly, waiting to launch the app from the original window
    launchTID = setInterval('launchJNLP(thisLocation +

    "juwoDemos_files/juwo.jnlp")', 200);
    }
    }
    }
    function webstartVersionCheck(versionString) {
    navigator.plugins.refresh(true);
    // First, determine if Webstart is available
    if (navigator.mimeTypes['application/x-java-jnlp-file']) {
    // Next, check for appropriate version family
    for (var i = 0; i < navigator.mimeTypes.length; ++i) {
    pluginType = navigator.mimeTypes.type;
    if (pluginType == "application/x-java-applet;version=" +
    versionString) {
    return true;

    }
    }
    }
    }
    function launchJNLP(app) {
    if (webstartVersionCheck("1.5")) {
    clearInterval(launchTID);
    window.location = app;
    }
    }

    function checkPlatform(string) {
    place = detect.indexOf(string) + 1;
    thestring = string;
    return place;
    }
    --></script>
     
    Anil, Jan 24, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.