window.URL.createObjectURL set filename to open pdf in new tab

I want to set a custom filename in createObjectURL of the blob. Right now, its … Read more window.URL.createObjectURL set filename to open pdf in new tab

I want to set a custom filename in createObjectURL of the blob. Right now, its showing something like this:

<URL>/bfefe410-8d9c-4883-86c5-d76c50a24a1d

const data = window.URL.createObjectURL(newBlob);
const pdfWindow = window.open();
pdfWindow.location.href = data;

I don’t want to download the file (its solution is already present on StackOverflow), it should be open in a new tab.

Source: JavaSript – Stack Overflow


Categories: NewsTags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *