How can I open with javascript link data:application/pdf;filename=generated.pdf;base64;DATA in Chrome 71?
Link from console opened successfully, but not fro
It's actually very easy, don't complicate things..
window.open(URL.createObjectURL(doc.output("blob")))
or a more verbose and less efficient version:
let newWindow = window.open('/');
fetch(doc.output('datauristring')).then(res => res.blob()).then(blob => {
newWindow.location = URL.createObjectURL(blob);
})
(You need to open the new window immediately after the onclick or Chrome will block the popup. This solution is not as good because there is an unnecessary conversion from datauri to blob)