views:

68

answers:

1

Hi I found lots of help for a javascript function which will check JRE version . It worked fine in Internet Explorer. But I am using Mac Operating system and I have Safari. The same examples did not work fine for Safari.

The following link tells about javascript function which will check JRE version

http://stackoverflow.com/questions/1873342/how-to-write-javascript-function-to-check-jre-version.

Also I have written small javascript program to check JRE version worked fine in Internet Explorer But It didnot give any result in safari.

<script type="text/javascript">
function checkJavaSupport () {
  var result = { 
    javaEnabled: false,
    version: ''
  };
  if (typeof navigator != 'undefined' && typeof navigator.javaEnabled != 'undefined') 
    result.javaEnabled = navigator.javaEnabled();
  else
    result.javaEnabled = 'unknown';
  if (navigator.javaEnabled()&& typeof java != 'undefined'){
    result.version = java.lang.System.getProperty("java.version");
  return result;
  }
  else
  return java.lang.System.getProperty("java.version");
}
</script>

So is there any way to check JRE version using Javascript.

Thanks Sunil Kumar Sahoo

A: 

why do you need this code at all? I've tested the code previously given to you in the question you mentioned on mac osx, linux, and windows with no problems (even with safari), and it works in all different types of browsers.

I don't see a reason to rewrite the code you were given before.

contagious
Hi the code you have mentioned refers to an external javascript file also. But I need a single function which itself does everything rather than depending on others because. I have insert that function in check condition of package maker. I donot think package maker allows external java script file.
Deepak
So move the code in the external file into your main file, and lose the dependency.
James Black