Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

loading xml in IE6

2 views
Skip to first unread message

Steve

unread,
Oct 14, 2008, 2:13:15 AM10/14/08
to
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.implementation.createDocument('', 'dummy', null);
doc.load('test.xml');

Thanks in advance, Steve.

Martin Honnen

unread,
Oct 14, 2008, 6:09:12 AM10/14/08
to

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.DOMDocument');
doc.onreadystatechange = 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
http://JavaScript.FAQTs.com/

0 new messages