Blob IE Fix
Blob IE Fix
by ayyanarj
HTML
<html>
<head>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div id="test">
test
</div>
</body>
</html>
JavaScript
$(document).ready(function() {
const blob = new Blob(["Lorem ipsum sit"], {type: "text/plain"});
var reader = new FileReader();
reader.addEventListener("loadend", function() {
console.log(reader.result);
alert(reader.result);
// reader.result contains the contents of blob as a typed array
});
reader.readAsText(blob);
});
//const blob = new Blob(["Lorem ipsum sit"], {type: "text/plain"});
// var textPromise = blob.text();
//blob.text().then(text => console.log(text));