简体   繁体   中英

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

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

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

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

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

Use deployJava.js to check the java installation.

<!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>

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

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

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

The result of x will be: Java Enabled: false

Try this:

https://cdnjs.com/libraries/jqplugin

Eg.

jQuery.browser.java //Java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM