【问题标题】:Error [object BlobConstructor]' is not a constructor in safari错误 [object BlobConstructor]' is not a constructor in safari
【发布时间】:2016-08-21 20:02:27
【问题描述】:

在本节中,我在 Windows 7 的 safari 中遇到此错误

'[object BlobConstructor]' is not a constructor (evaluating 'new Blob([data], {type: 'application/pdf'})')

并且使用Blob constructor not working in safari / opera?的解决方案后

'[object BlobConstructor]' is not a constructor (evaluating 'new Blob([data.buffer], {type: 'application/pdf'})')

我正在使用这个Blob 代码

var file = new Blob([data], {type: 'application/pdf'});

完整的代码是

      $scope.pdffile = "";
      $http.get('/api/myurl/'+report_id, {responseType: 'arraybuffer'})
         .success(function (data) {
             var file = new Blob([data], {type: 'application/pdf'});
             var fileURL = URL.createObjectURL(file);
             $scope.pdfcontent = $sce.trustAsResourceUrl(fileURL);
             $scope.pdffile = "download.pdf";
             $scope.loading = false;
      });

【问题讨论】:

  • 这个问题有什么解决办法吗?

标签: javascript angularjs safari blob


【解决方案1】:

Apple drops Windows support 早在 2012 年就用于 Safari 6。

显然您使用的是版本 5,其中 does not supports Blob API。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-15
    • 2021-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多