summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sfiligoi <isfiligoi@ucsd.edu>2013-12-17 02:48:01 +0000
committerIgor Sfiligoi <isfiligoi@ucsd.edu>2013-12-17 02:48:01 +0000
commitdd16d56dab3beec0ca191442ef13f11c9ebc6d3b (patch)
tree8663e21096f6ed85e896846f7336faab757cd9d8
parent65968d2184a67feed0af4a6eed57e02101dafde1 (diff)
Fix support for IE11, while keeping older IE versions still working
-rw-r--r--src/lib/binaryXHR.js26
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);