Add readAsBinaryString function to IE11
This commit is contained in:
parent
c6cdf2354f
commit
6889b0eccc
|
@ -22,6 +22,32 @@
|
|||
console.log(i18n.confirmExit);
|
||||
return i18n.confirmExit;
|
||||
}
|
||||
|
||||
// Is the browser IE?
|
||||
var isIE = /*@cc_on!@*/false || !!document.documentMode;
|
||||
|
||||
// If the browser is IE, add readAsBinaryString function and store the data
|
||||
if (isIE == true){
|
||||
if (FileReader.prototype.readAsBinaryString === undefined) {
|
||||
FileReader.prototype.readAsBinaryString = function (fileData) {
|
||||
var binary = "";
|
||||
var pt = this;
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
var bytes = new Uint8Array(reader.result);
|
||||
var length = bytes.byteLength;
|
||||
for (var i = 0; i < length; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
//pt.result - readonly so assign content to another property
|
||||
pt.content = binary;
|
||||
$(pt).trigger('onloadend');
|
||||
}
|
||||
reader.readAsArrayBuffer(fileData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
% end
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
|
|
Loading…
Reference in New Issue