I have a button which opens a URL action, which contains a .PDF file. I need this button to open the PDF file in a new tab when clicked. Although currently it opens in the same tab.
Current code:
<button target="_blank" onclick="location.href='@Url.Action("OpenPDF", "FlaggedSurveys", new { id = ViewBag.CompletedCamp } )'" type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true" target="_blank"></span> Open Survey PDF
</button>
I have also tried fromtarget"_blank":
<button formtarget="_blank" onclick="location.href='@Url.Action("OpenPDF", "FlaggedSurveys", new { id = ViewBag.CompletedCamp } )'" type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Open Survey PDF
</button>
Can someone tell me how to get the first Button opening on a new tab please?