javascript 如何使用代码检查浏览器中是否安装了 Java 插件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5631506/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 17:50:30  来源:igfitidea点击:

How to check whether Java plugins are installed or not in a browser using Code .?

javajavascript

提问by SSN

How to check whether Java plugins are installed or not in a browser using java or javascript or JSP Code .?

如何使用 java 或 javascript 或 JSP 代码检查浏览器中是否安装了 Java 插件?

回答by Ryan Fernandes

Java/Sun/Oracle provides a deployment toolkit scriptin the form of a JavaScript file that lets you achieve what you need.

Java/Sun/Oracle以 JavaScript 文件的形式提供了一个部署工具包脚本,可让您实现所需的功能。

You could invoke the getJREs()function which returns an array of currently-installed JRE version strings.

您可以调用getJREs()返回当前安装的 JRE 版本字符串数组的函数。

You can even install a particular JRE version if you need to, via the installJRE(requestVersion)function.

如果需要,您甚至可以通过该installJRE(requestVersion)功能安装特定的 JRE 版本。

回答by Dead Programmer

Use deployJava.jsto check the java installation.

使用deployJava.js检查Java安装。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<SCRIPT LANGUAGE="JavaScript" src="deployJava.js">
</SCRIPT>
<script type="text/javascript">
function call()
{
    if (deployJava.versionCheck("1.6.0+") || deployJava.versionCheck("1.4") || deployJava.versionCheck("1.5.0*")) 
    {
        alert("Java is Enabled");
    } else 
    {
        alert("Java is Not Enabled");
    }
}
</script>
<BODY onload="call();">
</BODY>
</HTML>

回答by Dominik Steiner

I tried jqplugin and deployJava first, but those did fail for IE8 at least. So i came over this lib, that has the most comprehensive documentation and implementation that i could find and worked for all the browser that i could test

我首先尝试了 jqplugin 和 deployJava,但至少对于 IE8 来说这些都失败了。所以我找到了这个库,它有最全面的文档和实现,我可以找到并适用于我可以测试的所有浏览器

http://www.pinlady.net/PluginDetect/Java/

http://www.pinlady.net/PluginDetect/Java/

回答by Pato de Borracha

From Navigator javaEnabled(): var x = "Java Enabled: " + navigator.javaEnabled();

导航器 javaEnabled()var x = "Java Enabled: " + navigator.javaEnabled();

The result of x will be: Java Enabled: false

x 的结果将是:Java Enabled: false

回答by ysrb

Try this:

试试这个:

https://cdnjs.com/libraries/jqplugin

https://cdnjs.com/libraries/jqplugin

Eg.

例如。

jQuery.browser.java //Java