Is Java enabled?

JavaScript FAQ | Client & Browser Configuration FAQ  

Question: Can JavaScript code determine whether Java is enabled?

Answer: Yes. To do so, use the navigator.javaEnabled() method. This method is supported in all major browsers (Internet Explorer, Firefox, Opera, Safari, Google Chrome).

Here's an example:

var javaOK = navigator.javaEnabled();

if (javaOK) document.write(''
  + 'Java is enabled: \n'
  + 'javaEnabled() returned '
  + javaOK.toString().bold()
 )
else document.write(''
  + 'Java is NOT enabled: \n'
  + 'javaEnabled() returned '
  + javaOK.toString().bold()
 )
In your browser, this code produces the following result:

See also:

  • Is JavaScript enabled?
  • Are cookies enabled?
  • Copyright © 1999-2011, JavaScripter.net.