Way to force IE to unload an ActiveX control

activexcominternet explorer

We have some dynamic HTML pages which include an <OBJECT> tag that instantiates an ActiveX control. The user may then navigate to another page, which contains an <OBJECT> tag that points to a newer version of the ActiveX control.

IE will download and install the new ActiveX on the second page, which is what that page is there for. The problem is that since IE loaded the ActiveX on the first page, it will now force the user to reboot before it will fully install the downloaded ActiveX, since it's being used by a process (IE).

In a normal container I would simply unload the ActiveX before trying to upgrade. Is there a way to force IE to do that? Going through a page which doesn't use the control would be acceptable if that would do the trick.

Edit:

Solutions that require the ActiveX itself to do something won't work simply because the problem is that the ActiveX is still in memory when IE starts installing the new version of the ActiveX. What I'm trying to do is to NOT have the ActiveX in memory when IE starts that process, so obviously I can't rely on anything in the ActiveX control itself.

Best Answer

Try the javascript delete statement:

function unloadObject(objId) {

    var obj = document.getElementById(objId);

    obj.parentNode.removeChild(obj);

    delete obj;
}

Call unloadObject(targetActiveXTagId) before opening your second page.

Ideally, you should build the upgrade mechanism into your ActiveX itself. I've seen several online game platforms does this with good results.