How to Check if Java is Enabled on a Web Browser Using Javascript


Javascript



In this article, we show how to check if Java is enabled on a web browser using Javascript.

All you have to do is run the following Javascript code below.



So the following code has a created variable called hasJava. This variable is set equal to navigator.javaEnabled().

The navigator is the object that can be seen as the web browser. The javaEnabled() function is callled on the navigator, or web browser.

The name of the javaEnabled() function is self explanatory. It checks to see whether or not Java is enabled on a web browser.

This function returns a boolean of true or false. If Java is enabled, it returns true. If Java is not enabled, it returns false.

So then we use an if else statement to output the statements shown above.

If the function returns true, we output that Java is enabled.

If the function is false, we write that the web broswer does not support Java.

This function is important because if the web page uses Java, such as an applet, for a user to use, you may want to check to see if Java is enabled on the browser. If not, you can output the link so that the user can install Java, which many sites do. Or you can simply output that, this page requires Java in order to display full content. Something like that.

But this just goes to show you that Javascript has a built-in function to check whether Java is enabled on a web browser.


Actual Javascript Output





Related Resources

Javascript- Onload Event Handler

Javascript- Onunload Event Handler

Javascript- Onfocus Event Handler

Javascript- Onblur Event Handler

Javascript- Onclick Event Handler

Javascript- Onchange Event Handler

Javascript- Onkeydown Event Handler

Javascript- Onkeyup Event Handler

Javascript- Onmouseover Event Handler

Javascript- Onmousedown Event Handler

Javascript- Onmouseup Event Handler

Javascript- Onmouseout Event Handler

Javascript- Onabort Event Handler

Javascript- Oncopy Event Handler



HTML Comment Box is loading comments...