By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

External Javascript to activate activex control

P: n/a
Hi all,

There has recently been a new update to internet explorer whereby
activex controls now load on a page unactivated. MSDN have a website
explaining a workaround where you do away with the <OBJECT> tag in your
html and instead use an external Javascript the control will load
activated.

http://msdn.microsoft.com/library/?u...ng_activex.asp

My old way of doing things was:

<TITLE>ProductOne</TITLE>
<META NAME = "System" Content="Test">
</HEAD>
<BODY>

<OBJECT ID="UserControl1"
CLASSID="CLSID:7F944D2D-D2FA-4EB7-A214-F2B6482FCD1C"
CODEBASE="TheCabFile.CAB#version=9,5,1,0">
</OBJECT>
</BODY>
</HTML>

Now i've tried to create my object using an external js like follows

//html file
<html>
<body>
<div id="DivID">
<script src="createElementExplicit.js"></script>
</body>
</html>

//js file
var myObject = document.createElement('object');
DivID.appendChild(myObject);
myObject.width = "500";
myObject.height = "300";
myObject.classid= "clsid:7F944D2D-D2FA-4EB7-A214-F2B6482FCD1C";
myObject.codebase =
"http://IPAddress/dir1/TheCabFile.cab#version=9,5,1,0";
myObject.uiMode = "none" ;
I cannot get this to work. If the user has the old control on their
machine it works fine and gets around this new problem of activating
the component. But where its a new installation, it does not download
the cab and install the control. Can any of you JavaScript/ActiveX
guru's help me out on this one? I feel that my js is wrong. Like can i
use myobject.codebase, i;m really trying to improvise the code on the
msdn website here to no avail so any help would be greatly appreciated,

Thanks

Bren

Mar 9 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
VK

punchbag wrote:
Hi all,

There has recently been a new update to internet explorer whereby
activex controls now load on a page unactivated. MSDN have a website
explaining a workaround where you do away with the <OBJECT> tag in your
html and instead use an external Javascript the control will load
activated.

http://msdn.microsoft.com/library/?u...ng_activex.asp

My old way of doing things was:

<TITLE>ProductOne</TITLE>
<META NAME = "System" Content="Test">
</HEAD>
<BODY>

<OBJECT ID="UserControl1"
CLASSID="CLSID:7F944D2D-D2FA-4EB7-A214-F2B6482FCD1C"
CODEBASE="TheCabFile.CAB#version=9,5,1,0">
</OBJECT>
</BODY>
</HTML>

Now i've tried to create my object using an external js like follows

//html file
<html>
<body>
<div id="DivID">
<script src="createElementExplicit.js"></script>
</body>
</html>

//js file
var myObject = document.createElement('object');
DivID.appendChild(myObject);
myObject.width = "500";
myObject.height = "300";
myObject.classid= "clsid:7F944D2D-D2FA-4EB7-A214-F2B6482FCD1C";
myObject.codebase =
"http://IPAddress/dir1/TheCabFile.cab#version=9,5,1,0";
myObject.uiMode = "none" ;


Try to set property first, and DivID.appendChild(myObject) at the very
end.
But it seems to me that you're reading this article wrong. It is not
about forcing object activation even if disabled (what use of disabling
would be then?) AFAICT it is about setting object activation params at
runtime. So if users have "disable ActiveX on page" on, your module
will not be activated no matter what.

Mar 9 '06 #2

P: n/a
Hi thanks for your reply. In the article in question they talk about
activating the control by tabbing onto it for instance. In a way its a
means of setting focus on the control. The actual installation of the
control i don't want to force (I'm not writing a virus here ;) ), more
that Im interested that when the control loads it will have focus.

I've managed to do this in the case where the user has previously
downloaded the control (before the update). But if the user hasn't
there seems to be something wrong with my codebase definition, as the
page loads and it never prompts me as to whether i would like to
install the activex control. I.e it doesnt download the cab. A blank
page simply loads. Could you hazard a further guess as to what is wrong
with my javascript. I tried your previous suggestion, however it failed
to work.

Bren

Mar 9 '06 #3

P: n/a
VK

punchbag wrote:
Hi thanks for your reply. In the article in question they talk about
activating the control by tabbing onto it for instance. In a way its a
means of setting focus on the control. The actual installation of the
control i don't want to force (I'm not writing a virus here ;) ), more
that Im interested that when the control loads it will have focus.

I've managed to do this in the case where the user has previously
downloaded the control (before the update). But if the user hasn't
there seems to be something wrong with my codebase definition, as the
page loads and it never prompts me as to whether i would like to
install the activex control. I.e it doesnt download the cab. A blank
page simply loads. Could you hazard a further guess as to what is wrong
with my javascript.


Takes us away from JavaScript as it seems not the issue (?) Is your
ActiveX properly signed? Verisign, Thawte or custom cert
*pre-installed* on the client machine? Otherwise activation request
will be silently ignored with more narrow security settings.

Mar 9 '06 #4

P: n/a
Yea there is definitely not an issue with the signing. After i make the
cab, it is signed, plus the fact that this worked perfectly prior to
this IE update. Ok, i'll bring this to an active x group, thanks for
your time though

Mar 9 '06 #5

P: 1
check this:
http://www.senchiu.de/iefix/iefix.html
should work with anytype of objects
May 3 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.