Glen J Fergo
Glen J Fergo

Reputation: 134

ActiveX on Windows 7 throws "Object doesn't support property or method" error

We have a third-party ActiveX. It seems to be working fine on a Windows XP machine (Internet Explorer 7). However, when we test on Windows 7 Professional 64-bit (Internet Explorer 9), we receive an error message -- "Object doesn't support property or method '{methodname}'"

Anyone knows what could be causing this?

Thoughts or suggestions would be greatly appreciated!

HTML:

<body onload="OpenActiveX()">
    <OBJECT id="OurActiveX" 
        name=”OurActiveX" 
        classid="clsid:43663B77-905C-4885-BC6B-4F57FE10A270" 
        VIEWASTEXT codebase="CS1504CAB.cab">
    </OBJECT>

    <script language="javascript">
        function OpenActiveX()
        {
            try
            {
                alert(document.OurActiveX.Echo("Hi I am here."));
                var sdata = document.OurActiveX.GetData();
                if(sdata == "0"){
                    document.getElementById("barcodes").innerHTML = "No barcodes found.";
                }
                else if( sdata == "1"){
                    document.getElementById("barcodes").innerHTML = "Could not find the barcode reader.";
                }
                else{
                    var adata = sdata.split(":");
                    document.getElementById("barcodes").innerHTML = adata[0] + "<BR/>" + adata[1];
                }
            }
            catch(Err)
            { 
                alert(Err.description);
            }
        }
    </script> 
<div id="barcodes" />

Upvotes: 1

Views: 10944

Answers (3)

dcinadr
dcinadr

Reputation: 685

ActiveX doesn't work with 64bit IE.

Upvotes: 0

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385375

There is no document.OurActiveX, because the name attribute in your HTML is broken (you've used a "smart quotes" in place of a normal double quote — if you look carefully, the syntax highlighting gives this away).

So, in fact, document.OurActiveX is undefined, and that's why you can't invoke any methods on it.

<OBJECT id="OurActiveX" name=”OurActiveX" classid="..."></OBJECT>

Becomes:

<OBJECT id="OurActiveX" name="OurActiveX" classid="..."></OBJECT>

Anyway, selecting DOM nodes like document.someName is highly antiquated and a little error-prone; get rid of the name attribute entirely and use document.getElementById to select the node, like you have elsewhere.

Upvotes: 0

Windy
Windy

Reputation: 1112

The error message indicates that the control is not available on the machine. You can check the security settings of IE on the client machine and verify the following security settings of IE to "Prompt" or "Enabled":

1) Download signed ActiveX controls 2) Run ActiveX Controls and plug-ins 3) Script ActiveX controls marked safe for scripting

Protected Mode is On by default in Windows 7. Turn the proected mode off or try running IE as administrator can get rid of the security problem.

Also, if you are using 64-bit IE, you need to make sure that the control supports 64-bit.

Upvotes: 2

Related Questions