Tim said:
You're in the wrong group, we discuss Javascript, not Java. The two
are completely different.
Try comp.lang.java.programmer
Not a directly JS related question, I agree, but I have a small applet
that I use in conjuction with JavaScript to determine exactly what the
OP is after...
here's The Applet Code...:
import java.applet.Applet;
import java.awt.HeadlessException;
import java.awt.*;
/**
* @author Dag Sunde
* @version 1.0
*/
public class Detector extends Applet {
public Detector() throws HeadlessException {
}
public void init() {
add(new Label(getJavaVersion()));
}
public String getJavaVersion() {
return System.getProperty("java.version");
}
}
And here's the HTML/JS with how to use it:
<head>
<script type="text/javascript">
var VERSION_REQUIRED = "1.5.0";
function checkPlugIn() {
// Check for Java Plugin Version
var javaVersion;
try {
javaVersion =
document.getElementById('detectPluginApplet').getJavaVersion();
}
catch (e) {
javaVersion = null;
}
if(javaVersion == null) {
alert("No Java Plugin detected");
}
else {
alert("Java Plugin version " + javaVersion + " detected");
}
if ( javaVersion >= VERSION_REQUIRED ) {
alert("You are cleared to procede...");
}
else {
alert("You must go to the java download page to get the correct Java
Plugin...");
document.location.href =
http://java.sun.com/javase/downloads/index.jsp;
}
return true;
}
</script>
</head>
<body onload="checkPlugIn();">
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
id="detectPluginApplet"
data="Detector.class"
type="application/x-java-applet"
codebase="."
width = "1"
height = "1"
align = "middle"
vspace = "0"
hspace = "0"<param name = "code" value = "Detector"/>
<param name = "codebase" value = ".">
<param name = "mayscript" value ="true"/>
<param name = "scriptable" value = "true">
<param name = "progressbar" value="true" />
<param name = "boxmessage" value="Laster detektor applet"/>
</object>
</body>