diff options
-rw-r--r-- | src/lib/binaryXHR.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/lib/binaryXHR.js b/src/lib/binaryXHR.js index b92d732..e4e7515 100644 --- a/src/lib/binaryXHR.js +++ b/src/lib/binaryXHR.js @@ -199,10 +199,17 @@ function FetchBinaryURL(url) { }
request.send(null);
- var response=request.responseBody;
- if (response==undefined){ // responseBody is non standard, but the only way to make it work in IE
- response=request.responseText;
+ var response=this.responseText;
+ try {
+ // for older IE versions, the value in responseText is not usable
+ if (IEBinary_getLength(this.responseBody)>0) {
+ // will get here only for older verson of IE
+ response=this.responseBody;
+ }
+ } catch (err) {
+ // not IE, do nothing
}
+
var bf=new BinaryFile(response);
return bf;
}
@@ -217,10 +224,17 @@ function FetchBinaryURL(url) { function FetchBinaryURLAsync(url, callback, callback_arg) {
var callback_wrapper = function() {
if(this.readyState == 4) {
- var response=this.responseBody;
- if (response==undefined){ // responseBody is non standard, but the only way to make it work in IE
- response=this.responseText;
+ var response=this.responseText;
+ try {
+ // for older IE versions, the value in responseText is not usable
+ if (IEBinary_getLength(this.responseBody)>0) {
+ // will get here only for older verson of IE
+ response=this.responseBody;
+ }
+ } catch (err) {
+ // not IE, do nothing
}
+
var bf=new BinaryFile(response);
if (callback_arg!=null) {
callback(bf,callback_arg);
|