javascript - Open new tab without leave focus on previous tab - Stack Overflow

i want to open a new tab on click but i want to previous tab always active, child tab not active by def

i want to open a new tab on click but i want to previous tab always active, child tab not active by default

My code is-

             <a onclick="window.open(URL); self.focus();>Click</a>

i want to open a new tab on click but i want to previous tab always active, child tab not active by default

My code is-

             <a onclick="window.open(URL); self.focus();>Click</a>
Share Improve this question asked Jan 3, 2013 at 11:00 Ishan JainIshan Jain 8,19111 gold badges51 silver badges76 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

This behaviour is up to the browser and can't be controlled by Javascript.

You can write code onload of the new window that gives focus back to the opener:

window.opener.focus();

notice that window.open opens a new window not a new tab, target=_blank opens a new tab (optionally according to browser settings)

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

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信