Hey there! any question in your mind? Ask It Now!.

Popular Categories

JavaScript- Open a new tab while focusing on an old tab

+3 votes
asked in Programming by monika (2,040 points)
How to open a new tab in background while focusing on old window, I want to open a new tab without changing focus on new tab .

Trying this but not working :

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

1 Answer

+1 vote
answered by Jamie

You can use this code :

<a href="http://edu.yoursfriends.com/" onclick="window.open('#','_blank');window.open(this.href,'_self');">Open a new tab in background</a>

Here when you will click on this link , this will open a new tab with current page and previous tab will open with new link (edu.yoursfriends.com)  .


This will help you, in case any query pls let me know.

Related Questions

Not a Member yet?

Ask to Folks Login

My Account
378 Folks are online
0 members and 378 guest online
Your feedback is highly appreciated