Home | Login
The MSIE Way
Posted 1 Jun 2005 by
Well, I was faced with a daunting task a few days ago (I thought it was going to be very easy at first until I couldn't come across any docs). I was meant to find out if the Sun and Microsoft Java VM plugins were installed on a client's browser using Javascript. After combining Google with MSDN and some references on the Sun Java forums, I was able to come up with this. It's implemented in a rather different and somewhat more reasonable way in other browsers. All you need to do is to make use of java.lang.System... in Javascript!

As for IE, you will need to use the ActiveXObject method for detecting what and what are available. To find out if the Microsoft Java VM Plugin is installed:
try
{
// attempt to create the object
var myObject = new ActiveXObject("MSJava");
}
catch(e)
{
// unable to create ActiveXObject
// therefore, the MS JavaVM is not available
}

// object was created successfully
if(myObject)
{
// the MS JavaVM was detected
// do stuff here...
}

The same code structure will go for the Sun Java VM except that the ActiveXObject will be JavaPlugin. It will go like so:
var myObject = new ActiveXObject("JavaPlugin");

And as an added bonus, if you want to find out if any version of Java Web Start is installed, all you have to do is:
var myObject = new
ActiveXObject("JavaWebStart.isInstalled");

Voila! Piece o' cake. The only downside to this is that the user may have disabled ActiveX plugins from running. Yeah, well, some people's computer systems have to be safe from malicious code.

And by the way, as you can see, the calendar has been placed just below the Recent Items. Do not click on any of the links in the calendar, as they will take you to pages that do not exist, yet. The calendar dates link to the archives, which I have not created, yet. I am not lazy, and you know that :)

Comments (0)

There are no comments for this post yet. Be the first to post a comment!

Post A Comment

Please enter the characters as they appear in the image
Captcha