diff options
-rw-r--r-- | binaryajax.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/binaryajax.js b/binaryajax.js index f674d9c..b721a9c 100644 --- a/binaryajax.js +++ b/binaryajax.js @@ -1,8 +1,8 @@ /* - * Binary Ajax 0.1.5 + * Binary Ajax 0.1.7 * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/ - * MIT License [http://www.opensource.org/licenses/mit-license.php] + * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] */ @@ -156,10 +156,10 @@ var BinaryAjax = (function() { if (typeof(oHTTP.onload) != "undefined") { oHTTP.onload = function() { - if (oHTTP.status == "200" || oHTTP.status == "206") { - this.binaryResponse = new BinaryFile(this.responseText, iDataOffset, iDataLen); - this.fileSize = iFileSize || this.getResponseHeader("Content-Length"); - fncCallback(this); + if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") { + oHTTP.binaryResponse = new BinaryFile(oHTTP.responseText, iDataOffset, iDataLen); + oHTTP.fileSize = iFileSize || oHTTP.getResponseHeader("Content-Length"); + fncCallback(oHTTP); } else { if (fncError) fncError(); } @@ -168,10 +168,14 @@ var BinaryAjax = (function() { } else { oHTTP.onreadystatechange = function() { if (oHTTP.readyState == 4) { - if (oHTTP.status == "200" || oHTTP.status == "206") { - this.binaryResponse = new BinaryFile(oHTTP.responseBody, iDataOffset, iDataLen); - this.fileSize = iFileSize || this.getResponseHeader("Content-Length"); - fncCallback(this); + if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") { + // IE6 craps if we try to extend the XHR object + var oRes = { + status : oHTTP.status, + binaryResponse : new BinaryFile(oHTTP.responseBody, iDataOffset, iDataLen), + fileSize : iFileSize || oHTTP.getResponseHeader("Content-Length") + }; + fncCallback(oRes); } else { if (fncError) fncError(); } |