8GB
8GB

Reputation: 79

How to open a url in new tab when user click menu item?

Currently, when the menu item is clicked on the web page in the event handler the new url is assigned to Response.Redirect and so it is opening in the same window. I want to be able to open the new url in a new tab keeping the main webpage open. I tried giving target="_blank" to the menu item and it doenst help . Can you suggest a solution?

Upvotes: 0

Views: 4313

Answers (2)

graham mendick
graham mendick

Reputation: 1839

I assume need to do a POST so you can calculate the new URL based on some posted data?

If that's the case, you could set target="_new" on the form tag - targets work for POSTs as well as GETs.

Or you could return the new URL to the client and then do a window.open when the page reloads.

Upvotes: 0

Wiktor Zychla
Wiktor Zychla

Reputation: 48230

Just attach a client side handler instead of a server side one.

Formally - instead of the "OnClick" attach "onmenuitemclick" to a javascript expression which opens new window - "window.open( ... )".

Upvotes: 0

Related Questions