错误 [对象 BlobConstructor]' 不是 safari 中的构造函数

Error [object BlobConstructor]' is not a constructor in safari

本文关键字:safari 不是 构造函数 对象 BlobConstructor 错误      更新时间:2023-09-26

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

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

在使用 Blob 构造函数的解决方案后,在野生动物园/歌剧中不起作用?

'[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;
      });

苹果早在2012年就放弃了对Safari 6的Windows支持。

所以显然你使用的是不支持 Blob API 的版本 5。