ActiveX control in IE intranet zone - blocked with

2019-08-16 09:07发布

问题:

I'm writing an intranet page for my company that requires the use of an embedded dll (COM). The dll is registered on all clients computers so it doesn't need to be downloaded from the page, it just needs to run.

I've tried using the following code to embed the control:

var newObj = new ActiveXObject("servername.classname");

And this works when testing locally, but from the intranet the object fails to instantiate with the js error "automation server can't create object". I suspect this is because IE(7) blocks ActiveX controls by default in the intranet zone. I've also tried using the <object> tag with no luck.

I have a deadline to get this finished and it's unlikely that the IT dept will get around to changing the company security settings before then, so unless its very straightforward for them to do it's not really an option.

So my question is: Is there any possible workaround that will allow me to embed the control so that it will at least prompt the user instead of silently blocking the control, without changing the default security settings in IE?

Almost everyone in the company uses some version of IE (up to 7), so it only needs to work for this.

All help and comments appreciated.

Thanks.

Update: If this absolutely isn't possible, I'm looking at using the dll from a script on the server in this question. I'd still rather do it client side though because the control has some nice user interfaces available.

回答1:

if you embed it with an <object> tag it should prompt you regardless; you could then make calls on it through the object tag. another trick which may work is to put: <!-- saved from url=(0013)about:internet --> as the first line of your html file; I don't know if this will work on the intranet zone, but from localhost that will cause the page to be treated as though it were an internet page.

I have used FireBreath plugins (which act as activex controls and can be called in the way you describe) and have never had an issue like this. Good luck!