JavaScript 可以在不加载的情况下检查 ActiveX 控件的版本吗?

发布于 2024-11-25 22:27:59 字数 820 浏览 1 评论 0原文

有没有办法询问 IE 它已安装并启用了哪个版本的 ActiveX 控件,而无需实际加载有问题的控件?我希望在其他浏览器中出现类似于 navigator.mimeTypes 的东西,我可以在其中获取有关插件的元数据,而无需接触插件本身。我有控件的 CLASSID 及其 servername/typename (我可以传递给 new ActiveXControl() 如果我想加载并实例化,我不这么认为);我几乎肯定可以获得我需要的任何其他识别密钥。

我知道我可以 实例化对象并使用自制的 GetVersion() 类型调用来询问版本,但在这种情况下我已经加载了控件。这很糟糕,因为(至少在 Win7 上的 IE9 中),如果 IE 加载了 ActiveX 控件,然后提示从 cab 文件安装更新版本,它会告诉用户重新启动他们的计算机在它允许访问该控件之前。如果您重新启动 IE,似乎就可以正常工作,但我们不能完全告诉用户忽略该提示。

此时我猜测答案是“你不能这样做;IE 和 ActiveX 是天启的两个骑士”,但我想我应该把它放在那里。

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 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

是伱的 2024-12-02 22:27:59

我还没有尝试过这个,但你也许可以通过条件注释来破解一些东西。

来自 此博客条目,附加组件可以注册带有名称和编号的版本字符串,然后将应用标准 IE 条件注释。如果你想用 JavaScript 来启动它,你也许可以(抱歉有点恶心),使用 document.write 写出标签周围的条件注释,然后在适当的情况下触发。

同样,由于我还没有尝试过这一点,因此 IE 可能不会处理 document.write 情况下的条件注释,但希望它会处理。

最后,请注意 条件注释在 IE 10 中将消失,所以这可能行不通,但这是可以由 Future You 解决的问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文