IE 11 - 显示字节数组图像的问题

时间:2017-03-31 05:36:00

标签: javascript angularjs image arraybuffer

我使用了以下代码

 $scope.download = function() {
    var request = new XMLHttpRequest();
    request.responseType = "arraybuffer";
    request.onload = function() {
     var blob = new Blob([request.response], {type: "image/png"})
      var urlCreator = window.URL || window.webkitURL;
        $scope.apiImgSrc = urlCreator.createObjectURL( blob );
         angular.element("#apiImage").attr('src', $scope.apiImgSrc);
       }
    request.open("POST", "/customer/downloadlogo");
      request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
      request.send(JSON.stringify({
     "customerSeq": 1000,
      "userId": "TEST-USER"
 }));

}

它在IE 11中不起作用并返回错误,如下图所示

0 个答案:

没有答案