Reputation: 1553
I have this code to save an excel using Blob
//Stream of data as res
var dataView = new DataView(res);
var blob = new Blob([dataView], {type: 'application/vnd.ms-excel'});
But in IE only the third line throw Invalid State Error even though in the document, it is fully supported
Upvotes: 0
Views: 1835
Reputation: 5954
It seems that the issue pertains to IE. Uint8Array
can be used in the constructor instead.
To convert a DataView
to a equivalent Uint8Array
:
var u8arr = new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength);
Write a function to replace all DataView
objects in the array passed to new Blob
. Or see the polyfill here.
Upvotes: 2