The topic-title speaks for itself. Is it possible to check if the client has JDK installed trough javascript? I know that it is possible to check the os and the browser but is that possible too?
4 Answers
You can check whether the client has java enabled with window.navigator.javaEnabled().
Note that:
The return value for this method indicates whether the preference that controls Java is on or off - not whether the browser offers Java support in general.
For more information, have a look at https://developer.mozilla.org/en/DOM/window.navigator.javaEnabled
Comments
I am presuming you have an Applet or a Web Start application which you want to run.
For those cases Oracle provides the Java Deployment Toolkit JavaScript which helps to detect Java versions and also offers methods to automatically write applet tags and Web Start launcher buttons.
As you can see at http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit (also contains link to downloading .js file) it can retrieve installed JREs or send the user to installation page of latest one. This might be what you are looking for.
Notes:
- This applies to detecting JREs. JDKs aren't used by the browser so there isn't a need to detect them.
- It might not work because of privacy settings or other browser/JRE configuration options.