ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Plug-In Detection with JavaScript
Subject:   Plugin detection
Date:   2003-07-01 01:36:09
From:   anonymous2
I try the plugin detection code to detect java plugin 1.3. but this code does not work.


My coding is as follows
-------------------------


function checkPlugin(){
var r = detectIE("8AD9C840-044E-11D1-B3E9-00805F499D93","java");
alert("RESULT = " + r);
}



function detectIE(ClassID,name){
result = false;
alert(ClassID);
document.writeln('<script language="VBscript">');
document.writeln('\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))');
document.writeln('msgbox(IsObject(CreateObject("' + ClassID + '")))');
document.writeln('</scr' + 'ipt>');
if (result)
return name+',';
else return '';
}


I call the checkPlugin method in body onload event.
Result is always empty.It does not detect plugin.