|
How to check If Java Is Enabled with JavaScript |
|
|
|
Contributed by Joe
|
|
Friday, 21 July 2006 |
Why check If Java Is Enabled with JavaScriptSometimes you have to know whether or not Java is enabled JavaScript provides a simple mechanism for determining this: the navigator.javaEnabled method. This method returns true if Java is enabled in the browser and false otherwise.
Example of Checking If Java Is Enabled with JavaScript<body> <script language=”JavaScript”> <!-- // --> </script> </body> - In the script block, call navigator.javaEnabled and assign the results to a variable:
<body> <script language=”JavaScript”> <!-- var ifJava = navigator.javaEnabled(); // --> </script> </bod - Use document.write to display a relevant message
<body> <script language=”JavaScript”> <!-- var haveJava = navigator.javaEnabled(); document.write(“Java is enabled: “ + ifJava); // --> </script> </body> - Open the file in a browser
If java senable in your browser, you will see "Java is enabled. true". Related ArticlesJavascript Cookie |
|
Last Updated ( Friday, 21 July 2006 )
|