W
wizard04frms
I'm having trouble figuring out what's going on with IE6's
Msxml2.XMLHTTP object. I have two feed addresses in this stripped down
version of my code below. Both work fine in Firefox (using the
XMLHttpRequest object), but only the thinkgeek one works in IE. In the
processFeed function, it shows the problem - the first alert shows 0
for the wikihow feed in IE, though it can still display the
responseText. Any insight?
//var feedAddr = "http://www.thinkgeek.com/thinkgeek.rss"; <<< works
fine in both
var feedAddr = "http://www.wikihow.com/feed.rss"; <<< only works in
FF
var url = "http://.../getXML.asp?url=" + feedAddr; <<< returns XML w/
content type text/xml
loadXMLDoc(url);
function loadXMLDoc(url)
{
var req;
if(window.XMLHttpRequest)
{
try { req = new XMLHttpRequest(); }
catch(e) { req = false; }
}
else if(window.ActiveXObject)
{
try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e)
{
try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) { req = false; }
}
}
if(req)
{
req.onreadystatechange = function(){ processReqChange(req); };
req.open("GET", url, true);
req.send("");
}
else { XMLObjError(); }
}
function processReqChange(req)
{
if (req.readyState == 4)
{
if (req.status == 200) { processFeed(req); }
else { XMLReqError(); }
}
}
function processFeed(req)
{
var xmlDoc = req.responseXML;
alert(xmlDoc.childNodes.length); <<< shows 0 in IE for the wikihow
feed
alert(req.responseText);
//... do stuff
}
Msxml2.XMLHTTP object. I have two feed addresses in this stripped down
version of my code below. Both work fine in Firefox (using the
XMLHttpRequest object), but only the thinkgeek one works in IE. In the
processFeed function, it shows the problem - the first alert shows 0
for the wikihow feed in IE, though it can still display the
responseText. Any insight?
//var feedAddr = "http://www.thinkgeek.com/thinkgeek.rss"; <<< works
fine in both
var feedAddr = "http://www.wikihow.com/feed.rss"; <<< only works in
FF
var url = "http://.../getXML.asp?url=" + feedAddr; <<< returns XML w/
content type text/xml
loadXMLDoc(url);
function loadXMLDoc(url)
{
var req;
if(window.XMLHttpRequest)
{
try { req = new XMLHttpRequest(); }
catch(e) { req = false; }
}
else if(window.ActiveXObject)
{
try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e)
{
try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) { req = false; }
}
}
if(req)
{
req.onreadystatechange = function(){ processReqChange(req); };
req.open("GET", url, true);
req.send("");
}
else { XMLObjError(); }
}
function processReqChange(req)
{
if (req.readyState == 4)
{
if (req.status == 200) { processFeed(req); }
else { XMLReqError(); }
}
}
function processFeed(req)
{
var xmlDoc = req.responseXML;
alert(xmlDoc.childNodes.length); <<< shows 0 in IE for the wikihow
feed
alert(req.responseText);
//... do stuff
}