Is Java Enabled?

You can use Javascript to test whether your visitor's browser has a Java plug-in installed and enabled. This allows you to use Javascript to write the HTML to load the Java object into the web page only when the browser supports Java. Where the browser doesn't support Java you can write something else in its place instead if you want to.

Here is an example of how you do it:

if (navigator.javaEnabled) {
alert('Java is enabled.');
} else {
alert('Java is not enabled.');

This page should have displayed an alert telling you if you have Java enabled.

Of course you will replace the alert statements with your own JavaScript code to provide what you want to include in the web page when the browser has Java enabled and what (if anything) you want to include if Java isn't supported. The first alert statement will probably be replaced by code that will attach your Java object into the page using an object tag. The second alert will be replaced by whatever you want to have display if the browser doesn't support Java.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow