current offers don't worry about Chrome, I always get a white page, now I use
const base64ImageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='; const contentType = 'image/png'; const byteCharacters = atob(base64ImageData.substr('data:${contentType};base64,'.length)); const byteArrays = []; for (let offset = 0; offset < byteCharacters.length; offset += 1024) { const slice = byteCharacters.slice(offset, offset + 1024); const byteNumbers = new Array(slice.length); for (let i = 0; i < slice.length; i++) { byteNumbers[i] = slice.charCodeAt(i); } const byteArray = new Uint8Array(byteNumbers); byteArrays.push(byteArray); } const blob = new Blob(byteArrays, {type: contentType}); const blobUrl = URL.createObjectURL(blob); window.open(blobUrl, '_blank');
thanks Jeremy!
fooobar.com/questions/24226 / ...
source share