ol2 icon indicating copy to clipboard operation
ol2 copied to clipboard

ActiveXObject creation fails in IE with strict security settings

Open doylem opened this issue 11 years ago • 1 comments

When loading GML or KML data into a Vector layer in Internet Explorer (any version), OpenLayers attempts to create an ActiveXObject to read the data. This will fail if the users have custom security settings in their browser, which is often the case in large business desktop environments.

To reproduce:

  • Load http://openlayers.org/dev/examples/gml-layer.html in any version of Internet Explorer.
  • Goto: Tools -> Internet Options -> choose the Security tab
  • Click the Custom Level button
  • Select the 'disabled' radio button for the following option:
    • Run ActiveX controls and plug-ins
  • Reload the above example, it will fail with the following error: "Automation server can't create object."

An IE parsing alternative to ActiveX controls does exist:

var datafile = "data.xml"
function getXMLdoc(datafile) {
    var xml = document.createElement("xml"); 
    xml.src = datafile;
    document.body.appendChild(xml);
    var xmlDocument = xml.XMLDocument;
    document.body.removeChild(xml);
    return xmlDocument;
}

Although i have not looked closely enough into the breadth of its support across all versions of IE.

I do realise that this is an edge case, and it's worth pointing out that there is no issue when using the default IE security settings.

doylem avatar Jun 04 '13 02:06 doylem

On Internet Explorer 11, I have needed to select the following option for Internet zone and the browser warns that it is not safe.

Initialize and script Activex controls not marked as safe for scripting

MattiL avatar Oct 10 '18 08:10 MattiL