Pregunta

OS version: Windows 8.1
MSIE (Microsoft Internet Explorer) version: 11.0.9600.16476 (KB2898785)

I have a simple HTML code that is creating my ActiveX Control (AX).
This code always worked in all previous versions of MSIE, but with the new MSIE-11 on Windows 8.1 it stopped working.

I bring here the HTML code that demonstrates the problem.
Please note:

  • The static HTML code that creates my AX (<OBJECT>) always work,
  • The dynamic JavaScript code that creates my AX (document.createElement) fails on MSIE 11

    <BODY>
        <BR>
        <BR>
            <INPUT TYPE="BUTTON" VALUE="CreateAX" OnClick="CreateAX()" STYLE="WIDTH: 89PX" />
        <BR>
        <BR>
        <!--    This always work:   -->
        <OBJECT ID      = "MyCtrl"
                CLASSID = "CLSID:F417FD96-3D17-4556-80AA-F7CEEE1E3FD8" 
                WIDTH   = 100
                HEIGHT  = 100>
        </OBJECT>
        <BR>
        <BR>
    </BODY>
    
    <SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
    function CreateAX() 
    {
        //  This will not work on MSIE 11
        var playbackObjectGlobal = document.createElement('object');
        playbackObjectGlobal.setAttribute('id',     'MyCtrl2');
        playbackObjectGlobal.setAttribute('classid','CLSID:F417FD96-3D17-4556-80AA-F7CEEE1E3FD8');
        playbackObjectGlobal.setAttribute('width',  '200');
        playbackObjectGlobal.setAttribute('height', '200');
        playbackObjectGlobal.setAttribute('hidden', 'false');
        document.body.appendChild(playbackObjectGlobal);
    }
    </SCRIPT>
    

After debugging I found that my boject does get created but without a window (m_hWnd==NULL) thus all GUI related features and events are disable.

Anyone is familiar with this problem?
Thanks, PazO

¿Fue útil?

Solución

After opening a call with Microsoft support I managed to resolve this issue.
I will bring here Microsoft answer as is:

With further debugging, we seems to be hitting known behavior and design change in dynamically adding objects.
Earlier, certain actions could force an object to instantiate prior to entering the control tree, which was breaking a number of sites.
As part of fixing that, we now fully commit an object when it enters the tree and its identity cannot be changed after that point. Because the repro page doesn't set the CLSID property until after the object enters the tree, the value is ignored.
If the step to set the CLSID on the control is moved before the object is inserted into the tree, the control should instantiate correctly.
In addition to the above changes, we also removed “Hidden” attribute as it was setting the object in hidden mode.

Before fix:

function CreateAX() 
{
    var playbackObjectGlobal = document.createElement('object');
    playbackObjectGlobal.setAttribute('id',         'MyCtrl2');
    playbackObjectGlobal.setAttribute('classid','CLSID:F417FD96-3D17-4556-80AA-F7CEEE1E3FD8');
    playbackObjectGlobal.setAttribute('width',      '200');
    playbackObjectGlobal.setAttribute('height',     '200');
    playbackObjectGlobal.setAttribute('hidden',     'false');
    document.body.appendChild(playbackObjectGlobal);
}

After fix:

function CreateAX_New() 
{
    var playbackObjectGlobal = document.createElement('object');
    //    *Change-1*   Next two lines swiched places:
    playbackObjectGlobal.setAttribute('classid','CLSID:F417FD96-3D17-4556-80AA-F7CEEE1E3FD8');
    playbackObjectGlobal.setAttribute('id',         'MyCtrl2');
    //    *Change-2*   Object is appended before sizes are set:
    document.body.appendChild(playbackObjectGlobal);
    playbackObjectGlobal.setAttribute('width',      '200');
    playbackObjectGlobal.setAttribute('height',     '200');
    //    *Change-3*   The 'Hidden' tag was removed
}

Now all is working for me on Windows 8.1, MSIE-11.

Otros consejos

ActiveX is highly restricted on Windows8/IE11 when in Metro mode.

It is locked down to only allowing a very limited set of controls, almost all of which are internal MS controls.

If you need to use any ActiveX controls that aren't in that list, it will only work if you're using Win8 in desktop mode. Even then, you may still need to manually set the browser settings to enable ActiveX.

See this post for more info.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top