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

0 votes
1 answer 125 views
+1 vote
2 answers 118 views
+1 vote
1 answer 168 views
+5 votes
2 answers 1,197 views
+1 vote
1 answer 265 views
+1 vote
2 answers 197 views
+1 vote
1 answer 776 views
+2 votes
1 answer 170 views
+4 votes
5 answers 2,809 views

Not a Member yet?

Ask to Folks Login

My Account
522 Folks are online
5 members and 517 guest online
Your feedback is highly appreciated