I try to use blob to show image in website but how I can get URL outside onload to return it in function?
var xhr = new XMLHttpRequest();
xhr.open("GET", "//fiddle.jshell.net/img/logo.png", true);
xhr.responseType = "arraybuffer";
xhr.onload = function(e) {
var arrayBufferView = new Uint8Array(this.response);
var blob = new Blob([arrayBufferView]);
var urlCreator = window.URL || window.webkitURL;
var imageUrl = urlCreator.createObjectURL(blob);
//window.URL.revokeObjectURL(imageUrl);
};
xhr.send();