[英]I would like to interactively detect when an ActiveX component has been installed, and asynchronously refresh a portion of the page
I am working on a website, and I would like to refresh a portion of the page after an ActiveX component has been installed. 我在一个网站上工作,并且在安装ActiveX组件后希望刷新页面的一部分。 I have a general idea of how to do this with polling, which I am working on getting going :
我对如何通过轮询进行操作有一个大致的了解,我正在努力进行:
function detectComponentThenSleep(){
try{
// Call what I want ActiveX for, if the method is available, or
// ActiveXComponent.object == null --- test for existance
document.getElementById("ActiveXComponent").someMethod();
}
catch{
// Try again, if the method is not available
setTimeout(detectComponentThenSleep, 100);
}
}
However, what I would REALLY like to do is something like this: 但是,我真正想做的是这样的:
ActiveXObject.addListener("onInstall", myfunction);
I don't actually have the source for the ActiveX component, but I have complete control of the page I am hosting it on. 我实际上没有ActiveX组件的来源,但是我可以完全控制托管它的页面。 I would like to use JavaScript, if possible, to accomplish this.
如果可能,我想使用JavaScript来完成此任务。
So, my question is 1.) will this actually work with the polling method? 因此,我的问题是1.)这实际上可以与轮询方法一起使用吗? and 2.) Is there an interrupt/listener like way of doing this?
和2.)是否有像这样的中断/监听器? I am sure I am missing something with connecting the dots here, I can already detect if the component is present, but I am having trouble doing this asynchronously.
我确定在此处连接点时会丢失某些东西,我已经可以检测到该组件是否存在,但是我在异步执行此操作时遇到了麻烦。
Thank you very much for your time and help, 非常感谢您的时间和帮助,
-Brian J. Stinar- -布莱恩·斯蒂纳(Brian J.
1.) This didn't work at all with the polling method. 1.)这对于轮询方法根本不起作用。 2.) I couldn't find an interrupt / listener way of doing this.
2.)我找不到执行此操作的中断/侦听器的方法。
I finally ended up just putting this entire ActiveX compnenent on it's own page. 我最后最终只是将整个ActiveX组件放在自己的页面上。 ActiveX does a page refresh on install, so I simply had the default page behavior as the what I wanted to happen when the component wasn't available.
ActiveX会在安装时刷新页面,因此我只是拥有默认的页面行为,即当组件不可用时想要发生的事情。 This is different than what I was trying to do, but it worked OK for my purposes.
这与我尝试执行的操作不同,但是对于我来说,它可以正常工作。
My recommendation to anyone in a similar situation is to just put the ActiveX component on it's own page, and pass data back and forth from this page. 我向处于类似情况的任何人的建议是,只需将ActiveX组件放在其自己的页面上,然后从该页面来回传递数据。 Otherwise, you are probably going to have a lot of the problems that I had.
否则,您可能会遇到很多我遇到的问题。
-Brian J. Stinar- -布莱恩·斯蒂纳(Brian J.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.