View Full Version : Testing if object exists in IE

Nov 29th, 2009, 06:06 PM
I have a script that I had written for me that works in IE (I guess its a ActiveX?) but I display it in the HTML page as the below HTML. I want to be able to tell in Javascript if this object is available in IE

<object id="IEPrinterChecker" classid="CLSID:506974F1-EA53-40C6-940A-4A1D47D5934B" width="0" height="0"></object>

Listed below you can tell I can check if the plugin is available in Firefox without having to specify in the html the object. How can I do this in IE?

<script language="JavaScript">
var plugin;
if ( window.ActiveXObject ) {
// IE
alert("How do I check for the plugin here?");
} else {
var type = "application/printer-checker-component;version="; // your mimeType
if (navigator && navigator.mimeTypes){
var mt = navigator.mimeTypes;
for (var i = 0; i < mt.length; i++){
if (mt[i].type == type) {
plugin = mt[i].enabledPlugin;
if (plugin) break;
if(plugin) {
// insert object and/or test the plugin with script
alert("plugin is available");
} else {
alert("plugin not available or disabled");