X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=ajax%2Fajax.js;h=f6a1d9e20ff6fbb117616d57414a98bdcf710c45;hb=414d059941343fa3c6bbbf40d3cb55cba4c4c85e;hp=632ed867da10cb3b86622f18acda903bf64f78f2;hpb=05a4b784e892ea0dd56201fa1b7a77c7a453bfa7;p=jquery.git diff --git a/ajax/ajax.js b/ajax/ajax.js index 632ed86..f6a1d9e 100644 --- a/ajax/ajax.js +++ b/ajax/ajax.js @@ -170,16 +170,20 @@ jQuery.ajax.active = 0; // Determines if an XMLHttpRequest was successful or not jQuery.httpSuccess = function(r) { - return ( r.status && ( r.status >= 200 && r.status < 300 ) || - r.status == 304 ) || !r.status && location.protocol == "file:"; + try { + return r.status ? + ( r.status >= 200 && r.status < 300 ) || r.status == 304 : + location.protocol == "file:"; + } catch(e){} + return false; }; // Get the data out of an XMLHttpRequest. // Return parsed XML if content-type header is "xml" and type is "xml" or omitted, // otherwise return plain text. jQuery.httpData = function(r,type) { - var xml = ( !type || type == "xml" ) && - r.getResponseHeader("content-type").indexOf("xml") >= 0; + var ct = r.getResponseHeader("content-type"); + var xml = ( !type || type == "xml" ) && ct && ct.indexOf("xml") >= 0; return xml ? r.responseXML : r.responseText; };