loading xml in IE6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    loading xml in IE6

    The following lines of script work fine in Firefox but give an "object
    doesn't support this property or method" error in IE6. Could someone
    recommend a way of loading a local xml file that also works for IE.

    var doc = document.implem entation.create Document('', 'dummy', null);
    doc.load('test. xml');

    Thanks in advance, Steve.
  • Martin Honnen

    #2
    Re: loading xml in IE6

    Steve wrote:
    The following lines of script work fine in Firefox but give an "object
    doesn't support this property or method" error in IE6. Could someone
    recommend a way of loading a local xml file that also works for IE.
    >
    var doc = document.implem entation.create Document('', 'dummy', null);
    doc.load('test. xml');
    You can use XMLHttpRequest (with IE 7 and 8) respectively new
    ActiveXObject(' Msxml2.XMLHTTP' ) in IE 6 (or older) to load the XML
    document, then access the responseXML property to have an XML DOM document.
    Or use
    var doc = new ActiveXObject(' Msxml2.DOMDocum ent');
    doc.onreadystat echange = function ()
    {
    if (doc.readyState === 4)
    {
    // now use doc here
    }
    };
    doc.load('test. xml');
    that should work as long as scripting of ActiveX objects is enabled.

    --

    Martin Honnen

    Comment

    Working...