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
3,073 views
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 121 views
+1 vote
2 answers 115 views
+1 vote
1 answer 163 views
+5 votes
2 answers 1,185 views
+1 vote
1 answer 260 views
+1 vote
2 answers 191 views
+1 vote
1 answer 771 views
+2 votes
1 answer 166 views
+4 votes
5 answers 2,673 views

Not a Member yet?

Ask to Folks Login

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