diff options
author | Jacob Seidelin <jseidelin@nihilogic.dk> | 2009-09-05 13:51:28 +0200 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2009-09-05 13:51:28 +0200 |
commit | d1ee32b839346e4b996afd1df962a743932be142 (patch) | |
tree | 21b0a4d5cf97bc943c051945339f1e0526c66009 | |
parent | fcd7fa1d7a3d621b2788057b53f3c4878ff7b9c4 (diff) |
binaryajax.js 0.1.7
found at https://gist.githubusercontent.com/ntulip/161492/raw/614f639c3f0c647320a0bae14a4707ba888c201c/BinaryJS
-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(); } |