I have this JS code:
link.href = 'data:application/pdf;base64,' + data;
where data
is base64 string. The link opens properly in Firefox, but not in Chrome when size of PDF file is huge (> 1.5MB).
Why doesn't this work? Is there any workaround?
I have this JS code:
link.href = 'data:application/pdf;base64,' + data;
where data
is base64 string. The link opens properly in Firefox, but not in Chrome when size of PDF file is huge (> 1.5MB).
Why doesn't this work? Is there any workaround?
Chrome doesn't allow opening data URLs for security reasons. You might be able to open the link using "Open in new tab" (right click menu).
As a work around, if possible, you can force the user to download the file using <a download="example.pdf" href= data:URL >
Or try using blob:URL instead of data:URL. This might help.