2

I'm working on ASP.NET Webform along with C#. I'm trying to open up page in new tab using Window.open(url,"_blank"). It's working fine in Mozilla but in the chrome, It opens in new window.

Note : I'm calling window.open by using Page.ClientScript.RegisterStartUpScript.

How to open this page using new tab in chrome?

Dharmik Bhandari
  • 1,702
  • 5
  • 29
  • 60
  • possible duplicate of [How can I open a link in new tab (and not new window)?](http://stackoverflow.com/questions/6296013/how-can-i-open-a-link-in-new-tab-and-not-new-window) – Johan Mar 13 '14 at 12:06

4 Answers4

2

The code is OK, but it will only open in a new tab if the action is triggered by the user otherwise chrome launches a new browser window. This behavior can be configured in chrome preferences. A example of this is the fiddle of Jordy, the example opens a new tab when you push the button "go!" but if you launch the code from chrome inspector's console it opens a new instance of the browser.

Javier Abrego
  • 462
  • 3
  • 12
  • So, How to change chrome preferences? – Dharmik Bhandari Mar 13 '14 at 12:22
  • sorry it looks like it's not an option anymore... anyway you can try to use these extensions but i'don't know if a client-side solution is an option for you... there you got the links. https://chrome.google.com/webstore/detail/open-new-blank-in-new-bac/bblhflcbilbefagmeoanbdiofmmnehda https://chrome.google.com/webstore/detail/one-window/papnlnnbddhckngcblfljaelgceffobn – Javier Abrego Mar 13 '14 at 12:37
1

This should work in Chrome (tested on Chrome for Mac 33.0.1750.146):

window.open('https://google.com', '_blank')

See this fiddle:

http://jsfiddle.net/Q5F4C/

Kukiwon
  • 1,222
  • 12
  • 20
0

This has already been answered here

CSS3 supports "open in new tab":

target-new: window | tab | none;

The handling of "_blank" is up to the browser so you cannot guarantee that it will open in a new tab and not in a new window.

Community
  • 1
  • 1
Johan
  • 1,016
  • 7
  • 13
0

In the page load event add the below:

Response.Write("<script>window.open(url);</script>");
user3240361
  • 397
  • 1
  • 9