Mani
Mani

Reputation: 2563

open actionlink in new window instead of new tab

I tried almost all the links and solution on google first page . but all the answers led to me in new tab instead of new window. While i want to open ActionLink in new window . Please provide something other than target = "_blank"

Upvotes: 2

Views: 3953

Answers (2)

Raphael_b
Raphael_b

Reputation: 1510

to be sure to open a new window without target=_blank (which will open a new tab), you might have to use some js. It will be difficult to achieve it only with HTML as all browser uses tabs nowadays. try: window.open("http://mynewwindowurl")

<button onclick="myFunction()">Open in a new window</button>

<script>
function myFunction() {
    window.open("http://mynewwindowurl.com");
}
</script>    

details: http://www.w3schools.com/jsref/met_win_open.asp

hope it helps

also check this link for js window open with specs: JavaScript open in a new window, not tab

Upvotes: 1

Umamaheswaran
Umamaheswaran

Reputation: 3878

You can try the below code

<a href="#" onclick="openNewWindow();">open</a>

<script type="text/javascript">
    function openNewWindow() {
        window.open("/values/index", "New Window", "height=500,width=500");
    }
</script>

In the url assume Values is your controller and Index as your action

Hope this helps!!

Upvotes: 2

Related Questions