tsclan
06-25-2009, 09:31 PM
Hi,
I am wanting to detect if the users browser has the Shockwave plug-in installed. At the moment I am focussing on detecting it within IE.
I have found two methods and I am not sure which one is the best.
One method simply detects if the browser supports ActiveX in which case I create a new ActiveX object:
var shockwaveInstalled = new ActiveXObject('SWCtl.SWCtl');
Then check if it returns TRUE
if(shockwaveInstalled) installed = true;
else installed = false;
Meanwhile there is a script that Adobe suggests I use which I found here:
http://kb2.adobe.com/cps/157/tn_15722.html
What differs in this script is it use JavaScript to write out VBScript that essentially calls the same ActiveX Object e.g.
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )) {
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('set tSWControl = CreateObject("SWCtl.SWCtl") \n');
document.write('if IsObject(tSWControl) then \n');
document.write('tVersionString = tSWControl.ShockwaveVersion("") \n');
document.write('end if');
document.write('</SCRIPT\> \n');
}
My feeling is I should avoid the VBScript method but I am not sure if it has a better compatibility with older versions of IE installed on older versions of Windows.
Any thoughts?
Thanks
I am wanting to detect if the users browser has the Shockwave plug-in installed. At the moment I am focussing on detecting it within IE.
I have found two methods and I am not sure which one is the best.
One method simply detects if the browser supports ActiveX in which case I create a new ActiveX object:
var shockwaveInstalled = new ActiveXObject('SWCtl.SWCtl');
Then check if it returns TRUE
if(shockwaveInstalled) installed = true;
else installed = false;
Meanwhile there is a script that Adobe suggests I use which I found here:
http://kb2.adobe.com/cps/157/tn_15722.html
What differs in this script is it use JavaScript to write out VBScript that essentially calls the same ActiveX Object e.g.
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )) {
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('set tSWControl = CreateObject("SWCtl.SWCtl") \n');
document.write('if IsObject(tSWControl) then \n');
document.write('tVersionString = tSWControl.ShockwaveVersion("") \n');
document.write('end if');
document.write('</SCRIPT\> \n');
}
My feeling is I should avoid the VBScript method but I am not sure if it has a better compatibility with older versions of IE installed on older versions of Windows.
Any thoughts?
Thanks