开发者

Capturing the finished installing event for ActiveX

At the moment I have a custom ActiveX plugin that drops down the usual yellow bar with the install button if the user doesn't have it. When they finish installing, however, I need the page to automatically refresh. Is there a way to detect that the plugin has been successfully installed that isn't constantly polling for the plugin's presence. That is to say, not doing this:

function checkForPlugin() {
    try {
            control = new ActiveXObject('Object.One');
            //refresh
    } catch (e) {
            setTimeout("checkForPlugin()" ,2000);
    }
}

This doesn't seem terribly professional and I'm curious if there is a better approach I could be taking. Come to think of it...I'm not exactly sure how I'd refresh there anyway, does anyone have insight on that as well? Thanks.

Update -- I have it working using the above method and even solved the refresh issue. I'm really not thrilled with this as an implementation though. It just feels wrong to leave the browser sitting there constantly polling in the background until it gets what it wants. It's not terrible I guess but I wish there was a more clean 开发者_Go百科approach. Does anyone have any ideas?


You could have your control fire an event and listen for it.


I think, capturing ActiveX install finish event is a kind of misconception.

Basically web pages run in single thread. There are no asynchronous processing such as a background installing.

In a life time of a web page, you will have the already installed ActiveX control or nothing. If control = new ActiveXObject throws, never you can instantiate the ActiveX control in this life time of the page.

That is, if the ActiveX control is not installed already you need to refresh the page to use the newly installed ActiveX control. This refresh is done automatically by the IE.


While the two answers given are perfectly valid, neither solution will really work within my time constraint or implementation. I thank you both for answering but ultimately I went with as described in my question.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜