How do I detect if ActiveX is enabled in the browser of client?
I tried following code, but it\'s not working in Firefox.
window.ActiveXObject not wo
Below code should work, It is working on IE6 & FF 3.6.12 atleast.
if(typeof(window.ActiveXObject)=="undefined"){
alert("ActiveX Object not supported");
}else {
alert("ActiveX Object supported");
}
What isn't working? Is that throwing an error in FF? How about
var hasAX = "ActiveXObject" in window;
ActiveX objects do not exist in anything but Internet Explorer. If you're trying to use them for XMLHTTPRequests, use the XMLHTTPRequest() object instead, using feature detection.
if ("ActiveXObject" in window) { /* Do ActiveX Stuff */ }
else { /* ActiveX doesnt exist, use something else */ }
It seems Firefox simply skips scripts containing ActiveX objects:
<script><!--
var activeXsupport = "ActiveX not supported";
// --></script>
<script><!--
var dummy = new ActiveXObject ('WScript.Shell');
activeXsupport = "ActiveX supported";
// --></script>
<script><!--
alert (activeXsupport);
// --></script>
So this gives me "supported" on IE11 and "not supported" on Firefox.
[Edit:] Since it also throws an error message on Firefox if the console is opened with [F12], I suggest this improvement:
<script><!--
var dummy = ''; var hasActiveX = false;
try {dummy = new ActiveXObject ('WScript.Shell'); hasActiveX = true;}
catch (err) {dummy = ''; hasActiveX = false;}
alert ('hasActiveX = ' + hasActiveX);
// --></script>
Edge Chromium supports ActiveX if it is made the default browser in settings and reloading in Internet Explorer Mode via "More Tools" is enabled:
edge://settings/defaultBrowser
Gerolf