开发者

Can JavaScript Check an ActiveX Control's Version Without Loading It?

Is there a way to ask IE what version of an ActiveX control it has installed and enabled without actually loading the control in question? I'm hoping for something akin to navigator.mimeTypes in other browsers, where I can get metadata about the plugins without touching the plugins themselves. I have the control's CLASSID and its 开发者_JAVA百科servername/typename (which I can pass to new ActiveXControl() if I want to load and instantiate, which I don't); I could almost certainly get whatever other identifying key I need.

I know that I can instantiate the object and use a home-grown GetVersion()-type call to ask it the version, but in that case I've loaded the control. This is bad because (at least in IE9 on Win7), if IE has loaded an ActiveX control and is then prompted to install a newer version from a cab file, it will tell the user to restart their computer before it will allow access to the control. It seems to work fine if you just restart IE, but we can't exactly tell the users to just ignore the prompt.

At this point I'm guessing that the answer is "you can't do that; IE and ActiveX are two horsemen of the apocalypse" but I figured I'd put it out there.


I haven't tried this, but you may be able to hack something together with conditional comments.

From this blog entry, add-ons can register a version string with a name and number, then the standard IE conditional comments would apply. If you want to kick it off with JavaScript, you may be able to (sorry for the ickiness), use document.write to write out the conditional comment around a tag, which then would fire in the appropriate case.

Again, since I haven't tried this, it's possible IE won't process the conditional comment in the document.write case, but hopefully it does.

Finally, be aware that conditional comments are going away in IE 10, so this might not work then, but that's something that can be solved by a Future You.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜