0

The idea is we have a file generated from the backend and we want to display it in the browser in a new tab

We used to have an anchor tag like

<a href={documentUrl} target="_blank" </a> 

Where the file was sent with "Content-Disposition:inline" as part of the header

now Content-Disposition is gone because the backend wants the frontend to manage whether to open the file in a new tab or download it

is this possible? Preferably without using window.open or grabbing the blob data - using just the file url

Edit: it's opening a new tab but then a pop up appears requesting where to download the file it doesn't actually present the file in the new tab

3
  • Is the anchor as you have it not working? Commented Jan 20, 2020 at 19:03
  • sorry good point - it's opening a tab but then a pop up appears requesting where to download the file it doesn't actually present the file in the new tab Commented Jan 20, 2020 at 19:13
  • You can try using an object tag to embed the PDF on a plain HTML page like in How to display a PDF stream in a browser using javascript Commented Jan 20, 2020 at 19:30

0