admin管理员组文章数量:1405729
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
2 Answers
Reset to default 4This 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)
本文标签: javascriptOpen new tab without leave focus on previous tabStack Overflow
版权声明:本文标题:javascript - Open new tab without leave focus on previous tab - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744936408a2633214.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论