I am adding static help pages to my MVC application.
Clicking the help link directs to an Action Method with a unique identifier, telling the controller which page to show.
I know it can be done from within the View using Javascript or an anchor tag.
You can also open the static page from the controller, but it does not open in a new tab:
var result = new FilePathResult("~/Help/index.html", "text/html");
return result;
I cannot seem to open this static page in a new tab from the controller. Is this even possible?
EDIT
As to why How do you request static .html files under the ~/Views folder in ASP.NET MVC? does not solve my problem:
My static file do not live in the Views folder and it also does not address opening the page in a new tab.
EDIT 2 - Solution
Since this cannot be done directly from the controller I implemented the following in my View's scripts.
$('#linkAppHelpButton').off().on('click', function () {
$.ajax({
type: "GET",
url: '@Url.Action("ReturnHelpPage", "Help", null)',
data: { identifier: "index" },
success: function (page) {
window.open(page, '_blank');
},
})
});