I'm encountering an issue with displaying a PDF file in Google Chrome, as the code works fine in Firefox.
HTML View
<div>
<object ng-bind="pdfcontent" data="{{pdfcontent}}" type="application/pdf" width="100%" height="800px">
</object>
</div>
AngularJS Code
$http.get('/myurl/', {responseType: 'arraybuffer'})
.success(function (data) {
var file = new Blob([data], {type: 'application/pdf'});
var fileURL = URL.createObjectURL(file);
$scope.pdfcontent = $sce.trustAsResourceUrl(fileURL);
});
Two errors are being triggered:
firebug-lite.js:18877 Uncaught InvalidStateError: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer').(anonymous function) @ firebug-lite.js:18877
jquery.js:2812 GET 404 (Not Found)
If you have any insights on what might be wrong with my code and how to resolve it, I would greatly appreciate your help. Thank you.