deployJava.js 在 IE 11 中未检测到 JRE
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20085015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
deployJava.js not detecting JRE in IE 11
提问by William W
I'm using deployJava.js to include applets like so:
我正在使用 deployJava.js 来包含这样的小程序:
<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 appletand by setting var version = '1.1'; in the js above which they say will won't force a specific version.
一些使用 IE 11(在 Windows 7 中,我不确定 Windows 8.1)的用户抱怨说,即使已经安装了最新的 Java,它也会自动将它们转发到 Java 下载页面(在小程序加载之前)。我已经通过使用Java 的验证小程序和设置 var version = '1.1';验证了这一点。在上面的 js 中,他们说不会强制使用特定版本。
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 Tooldoesn't load for them. It says java is not installed. Restarting the browser and the PC seem to have no affect on this.
验证小程序告诉我 Java 已安装,即使 version='1.1' 它仍然重定向它们。我注意到的另一件事是Java 卸载工具不会为它们加载。它说没有安装java。重启浏览器和PC似乎对此没有影响。
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.
有没有人遇到过这个?关于如何禁止 deployJava 转发到下载页面的任何建议,或者 IE 11 解决方法。
采纳答案by Mr. T
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.
经过一番挖掘,这似乎是由于 Microsoft 更改了 Internet Explorer 11 报告的用户代理(请参阅此处)。"deployJava.js" 库有它自己的浏览器检测功能 (getBrowser()),它不能正确处理 IE11 的用户代理。
The following bug reports from OpenJDK talk about this issue:
以下来自 OpenJDK 的错误报告讨论了这个问题:
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:
我尝试了 deployJava.js 的“官方”版本(此处),但尚未更新修复程序。建议的解决方法是修改“getBrowser”方法以查找除“MSIE”之外的“trident”。如果您不想等待 Oracle 进行更新,您可以创建自己的 deployJava.js 本地副本并替换:
(o.indexOf("msie")!=-1)
(o.indexOf("msie")!=-1)
with
和
((o.indexOf("msie")!=-1)||(o.indexOf("trident")!=-1))
((o.indexOf("msie")!=-1)||(o.indexOf("trident")!=-1))
回答by kypronite
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()
正如 T 先生在他们最新的 deployJava.js 中提到的,Oracle 已经解决了这个问题。
但是我仍然遇到错误,我仍然被重定向到 http://java.com/en/download/ie_manual.jsp
尽管我在 IE11 中安装了最新的 JRE。在深入研究 deployJava.js 后,结果在函数 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
以上归功于SebLD 的解决方案
回答by Pedro
Although not a great solution, unsetting the compatibility view in IE solved the problem.
虽然不是一个很好的解决方案,但在 IE 中取消兼容性视图解决了这个问题。