It is working on the same tab though.
<a href="path" class="some-class" target="_blank">Terms of Use</a>
It is working for the file types .html
and .txt
but not for .pdf
even .docx
files get downloaded.
I am writing this code in cshtml.
I want to open a pdf document in a new tab.
2
Answers
Here’s an example of what I do for this…
In view (.cshtml):
In controller (OpenFile.cs):
The key seemed to be to return File object with "application/pdf" mimetype without the 3rd parameter string of filename.
Any local downloaded file should work with "_blank" if user has not set their browser to download only (rather than download after view).
So simply point as you have done, to the a href="local.pdf" or if its remote the URL.pdf
However
that same file in some recent chromium’s like Edge may be truly a blob blank
! (so in the run up to adding Acrobat as replacing Skia/Foxit), MS ? or chromium? seem to have lost the plot?