问题
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 working in Firefox
any ideas?
check the example here: http://jsfiddle.net/qXSvQ/2/
I get false
when I run this example.
回答1:
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 */ }
回答2:
What isn't working? Is that throwing an error in FF? How about
var hasAX = "ActiveXObject" in window;
回答3:
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");
}
来源:https://stackoverflow.com/questions/4313438/how-do-i-detect-if-activex-is-enabled-in-the-browser-of-client