I have a web service that sends a file to the client as an array, which is then read into a blob:
$scope.contentType = response.headers["content-type"]; $scope.file = new Blob([response.data], { type: $scope.contentType }); $scope.fileUrl = URL.createObjectURL($scope.file); $scope.content = $sce.trustAsResourceUrl($scope.fileUrl);
I use the object tag as a container:
<object id="documentContainer" ng-show="loaded" ng-attr-type="{{contentType}}" ng-attr-data="{{content}}" class="document-container"></object>
This works great in FF, chrome, mobile browsers, web browsers designed by alien species that have never had contact with humanity, etc., but not in IE.
When the object tag data parameter is set, IE responds to the console using
Error: access denied.
This is similar to some security feature in IE where it does not want to use the file as a source, since it is located on the client machine. It denies access even if you use javascript to create a new dom element with a set of data sources.
Microsoft provides its own blob methods, such as msSaveOrOpenBlob , but I need to be able to insert the file into the browser, rather than asking the user to open the file in an external application.
Does anyone know of a workaround or a way to embed blob, which can be a wide variety of file types, in IE? I would be very uninterested in reorganizing the web service and front end code to host IE, but it looks like it could be.
javascript angularjs internet-explorer pdf blob
mrturburdaugh
source share