Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deployJava.js not detecting JRE in IE 11

I'm using deployJava.js to include applets like so:

<script>
    var attributes = {
        name:'ForrestGump', id:'ForrestGump',
        codebase:'java/', code:'ForrestGump',
        cache_archive:'ForrestGumpSigned.jar',
        cache_option:'Plugin',
        initial_focus:false,
        width:1, height:1 };
    var parameters = { } ;
    var version = '1.7.0' ;
    deployJava.runApplet(attributes, parameters, version);
</script>

Some users using IE 11 (in Windows 7, I'm not sure about windows 8.1) have complained that it will automatically forward them to the Java download page (before the applet loads) even though the latest java is already installed. I have verified this by using both Java's Verification applet and by setting var version = '1.1'; in the js above which they say will won't force a specific version.

The verification applet tells me Java is installed, and even with version='1.1' it still redirects them. Another thing I noticed is that the Java Uninstall Tool doesn't load for them. It says java is not installed. Restarting the browser and the PC seem to have no affect on this.

Has anyone run into this before? Any advice on how I can disable deployJava from forwarding to the download page no matter what, or else an IE 11 workaround.

like image 335
William W Avatar asked Nov 20 '13 00:11

William W


2 Answers

After some digging it appears that this is due to Microsoft changing the user agent that Internet Explorer 11 reports (see here). The "deployJava.js" library has it's own browser detection function (getBrowser()) and it does not handle the user agent for IE11 correctly.

The following bug reports from OpenJDK talk about this issue:

  • JDK-8026474
  • JDK-8028629

I tried the "official" version of deployJava.js (here) and it has not been updated with a fix yet. The suggested work-around is to modify the "getBrowser" method to look for "trident" in addition to "MSIE". If you don't want to wait for Oracle to make the update you could just create your own local copy of deployJava.js and replace:

(o.indexOf("msie")!=-1)

with

((o.indexOf("msie")!=-1)||(o.indexOf("trident")!=-1))

like image 85
Mr. T Avatar answered Oct 25 '22 23:10

Mr. T


Oracle already fix this issue as mentioned by Mr. T in their latest deployJava.js.
But I still encounter error ,I was still being redirected to http://java.com/en/download/ie_manual.jsp

Although I installed latest JRE in my IE11. After digging into deployJava.js, turns out in function testUsingActiveX()

if (typeof ActiveXObject == "undefined" || !ActiveXObject) {
   g("[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?");
   return false
}

I modifed the above function to below

if("ActiveXObject" in window)
{
  //do nothing
}
else if (typeof ActiveXObject == "undefined" || !ActiveXObject) {
   g("[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?");
   return false
}

Solution above credit to SebLD

like image 24
kypronite Avatar answered Oct 25 '22 23:10

kypronite