How to open 2 links in one click? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to open 2 links in one click?

25th Jul 2017, 3:58 PM
Sandeep Kumar R
Sandeep Kumar R - avatar
6 Answers
+ 4
use: _blank it will open them in two separate tabs
25th Jul 2017, 4:10 PM
Sumit
Sumit - avatar
+ 3
Without JavaScript, it's not possible to open two pages by clicking one link unless both pages are framed on the one page that opens from clicking the link. With JS it's trivial: <p><a href="#" onclick="window.open('http://google.com'); window.open('http://yahoo.com');">Click to open Google and Yahoo</a></p> Do note that this will be blocked by popup blockers built into web browsers but you are usually notified of this.
25th Jul 2017, 4:25 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 2
What are you trying to achieve? Anything in specific. Provide more details.
25th Jul 2017, 4:02 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 1
I tried putting 2 links it only open first link
25th Jul 2017, 4:07 PM
Sandeep Kumar R
Sandeep Kumar R - avatar
+ 1
for example code to open www.google.com and www.youtube.com in one click
25th Jul 2017, 4:09 PM
Sandeep Kumar R
Sandeep Kumar R - avatar
+ 1
code to open 2 links in one click
25th Jul 2017, 4:22 PM
Sandeep Kumar R
Sandeep Kumar R - avatar