jquery - Open page using new tab in chrome by javascript - Stack Overflow

I'm working on ASP.NET Webform along with C#. I'm trying to open up page in new tab using Win

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?

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?

Share Improve this question asked Mar 13, 2014 at 11:51 Dharmik BhandariDharmik Bhandari 1,7025 gold badges33 silver badges61 bronze badges 1
  • possible duplicate of How can I open a link in new tab (and not new window)? – Johan Commented Mar 13, 2014 at 12:06
Add a ment  | 

4 Answers 4

Reset to default 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.

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

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

See this fiddle:

http://jsfiddle/Q5F4C/

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.

In the page load event add the below:

Response.Write("<script>window.open(url);</script>");

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745170541a4614897.html

相关推荐

  • jquery - Open page using new tab in chrome by javascript - Stack Overflow

    I'm working on ASP.NET Webform along with C#. I'm trying to open up page in new tab using Win

    6小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信