开发者

I would like to interactively detect when an ActiveX component has been installed, and asynchronously refresh a portion of the page

开发者 https://www.devze.com 2022-12-19 03:49 出处:网络
I am working on a website, and I would like to refresh a portion of the page after an ActiveX component has been installed. I have a general idea of how to do this with polling, which I am working on

I am working on a website, and I would like to refresh a portion of the page after an ActiveX component has been installed. 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 h开发者_JAVA技巧osting it on. I would like to use JavaScript, if possible, to accomplish this.

So, my question is 1.) will this actually work with the polling method? and 2.) Is there an interrupt/listener like way of doing this? 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-


1.) This didn't work at all with the polling method. 2.) I couldn't find an interrupt / listener way of doing this.

I finally ended up just putting this entire ActiveX compnenent on it's own page. 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. 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. Otherwise, you are probably going to have a lot of the problems that I had.

-Brian J. Stinar-

0

精彩评论

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

关注公众号