Browse - Programming Tips - How do I use a COM object (.OCX file) aka ActiveX in Internet Explorer?

Date: 2009jul8
OS: Windows
Keywords: IE

Q.  How do I use a COM object (.OCX file) aka ActiveX in Internet Explorer?

A.  Use <object> with your class id.

<script> var gObj; function init() { gObj = document.getElementById('myocx'); gObj.MyMethod1(); } </script> <body onload="init()"> <object classid="clsid:00000000-0000-0000-0000-000000000000" id="myocx" width="200" height="200"> </object> <button onClick="gObj.MyMethod2()">MyMethod2</button> </body>
This does *not* work in Firefox or other browsers.