locked
Open a Link in a browser new tab RRS feed

  • Question

  • User457850011 posted

    I am trying to get an action link open in a new tab but it is opening in a new window. Below is my code using asp.net mvc 5 razor view

     <h4>Only new items will show up here.Click here to see old items<a href="@Url.Action("emp", "empcontroller", new {target= "_blank"})">Old items.</a></h4>

     when I right click the link, I can open it in new tab but I want it to open in new tab when I click on it opens in new tab instead of right click.

    Any help be appreciated.

    Wednesday, January 13, 2021 6:28 PM

Answers

  • User457850011 posted

    Hi 

    Thanks for all the responses. I have got it working myself. This is how I did it

    Only new items will show up here.Click here to see old items@Html.ActionLink("Old items.", "emp","empcontroller",null, new {target= "_blank"})

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 14, 2021 12:33 AM

All replies

  • User-775646050 posted

    This is not something you can control as a developer. Opening links in tabs vs windows is something that is controlled by the user's browser preferences.

    Wednesday, January 13, 2021 7:56 PM
  • User457850011 posted

    Hi 

    Thanks for all the responses. I have got it working myself. This is how I did it

    Only new items will show up here.Click here to see old items@Html.ActionLink("Old items.", "emp","empcontroller",null, new {target= "_blank"})

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 14, 2021 12:33 AM