简体   繁体   English

如何检测是否加载了ActiveX控件?

[英]How can I detect if an ActiveX control is loaded?

I would like to integrate the Aurigma image uploader ( http://www.aurigma.com/Products/ImageUploader/ ) on a website. 我想在网站上集成Aurigma图像上传器( http://www.aurigma.com/Products/ImageUploader/ )。

On Internet Explorer the control is an ActiveX control which issues a security prompt prior to the first installation. 在Internet Explorer上,控件是一个ActiveX控件,它在第一次安装之前发出安全提示。

To give the user instructions about how to react to this security warning I'd like to display an information window. 为了向用户提供有关如何对此安全警告作出反应的说明,我想显示一个信息窗口。 I want to display this window only the control is not loaded. 我只想显示这个窗口没有加载控件。

  if (controlIsNotLoaded()) {
    doSomething()
  }

How can I do that? 我怎样才能做到这一点?

Assuming you have the id of the object tag (if it is coming from that) then test for the object attribute of the element against null. 假设您具有object标记的id(如果它来自那个),则测试该元素的object属性是否为null。

function controlNotLoaded()
{
     var obj = document.getElementById("controlId");
     return (obj.object == null);
}

If you are using new ActiveXObject then it will throw an exception. 如果您使用新的ActiveXObject,那么它将抛出异常。 Of course this will only tell you if the control isn't able to be created, not necessarily why. 当然,这只会告诉您是否无法创建控件,不一定是为什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM