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,599 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 132 views
+1 vote
2 answers 126 views
+1 vote
1 answer 175 views
+5 votes
2 answers 1,217 views
+1 vote
1 answer 270 views
+1 vote
2 answers 212 views
+1 vote
1 answer 795 views
+2 votes
1 answer 185 views
+4 votes
5 answers 3,120 views

Not a Member yet?

Ask to Folks Login

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