Open multiple links / windows in a single click

| 52 comments

A reader asked if she can make a navigation tab open more than one link when clicked. The answer is YES it can be done, with the help from a small Javascript.

(Now if you came here looking for a way YOU can open multiple links on pages you visit, try Snap Links, a  Firefox addon.)

multiple links

First let’s look at an HTML code for a regular anchor tag <a>:

<a href="YOUR_URL" target="_blank">Link text</a>

When clicked, this code will open YOUR_URL in a new window/tab.

To add another link, just add the code below before the closing bracket “>” in the opening tag:

onclick="window.open(&quot;YOUR_2nd_URL&quot;);"

It will open YOUR_2nd_URL in a second new window/tab. To add more links, simply add more window.open(); before the closing quotation mark.

So if you were to open three links, your anchor will look like this:

<a href="YOUR_URL" target="_blank" onclick="window.open(&quot;&quot;YOUR_2nd_URL&quot;&quot;); window.open(&quot;&quot;YOUR_3rd_URL&quot;&quot;);">Link text</a>

This is an example of an anchor that opens three links (in three windows or tabs) in a single click:

<a href="http://bloggersentral.blogspot.com/" target="_blank" onclick="window.open(&quot;http://www.tourism.gov.my/&quot;); window.open(&quot;http://www.tic.kelantan.gov.my/&quot;);">This anchor opens three links in a single click</a>

Now see the code in action, click on it and see what happens.

This anchor opens three links in a single click

Before you apply this new trick, do take into account your readers’ would be reactions. Unless forewarned, I personally would feel tricked if say three windows/tabs pop up when I click something.

Enjoy!

52 comments to "Open multiple links / windows in a single click"

juk November 21, 2009 at 3:10 PM    

Salam ziarah. Blog anda sgt menarik. Jemputlah dtg ke blog saya pula. Jom kita saling jadi follower? Buat MOU, OK? Thanks.

Zuki (zukidin.blogspot.com)

Termite information December 2, 2009 at 8:33 PM    

I've been trying to find an answer to this but I'm not sure how to word it correctly. What I'm trying to do is highlight a group of links and then have the set of links open in new tabs.

Thanks for the info! I am looking for this.glad to see your post!

Greenlava December 3, 2009 at 7:42 PM    

Termite information,
I think FireFox have an addon specially for that. Try seacrh for it.

Logo Designs,
You're welcome

Canada provinces December 18, 2009 at 12:08 AM    

So, on Column A I have multiple URLs. How do I open all of them at the same time? Without having to click on each and every single URL. Thanks.

Greenlava December 18, 2009 at 12:14 AM    

Canada provinces,
Try Snap Links FireFox addon.

Ozone depletion January 3, 2010 at 5:14 PM    

Brilliant. Simple. Insanely useful. Add this to yesterday's sweet Tab Scope and you've just given Firefox two big kicks in the productivity pants. Snap Links is free

zahid June 2, 2010 at 6:40 PM    

Perfect . I just found what i wanted to do ;) . Keep going towards success ...

Greenlava June 4, 2010 at 12:24 PM    

@zahid
Thanks for the encouraging words :)

seema October 11, 2010 at 7:29 PM    

Good One..............

johnnieq December 16, 2010 at 7:06 AM    

Pretty neat script. I tried the "This anchor opens three links in a single click" and it works great. I do not want the shortcut on a web page, I'd like it on my desktop. Is there a way to do this? I tried saving the link to my Desktop and running it, but it only opens the first site.

Greenlava December 16, 2010 at 1:39 PM    

@johnnieq
There a simple trick for this -use bookmarks.
You store those links in one bookmark folder. To open all of them at once, Ctrl+Click the folder and voila!

beads February 15, 2011 at 10:01 AM    

This is a great post it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it

Greenlava February 15, 2011 at 1:26 PM    

@beads
Glad you've enjoyed it. There are a lot more tutorials here, you can easily find them using the search bar.

old_trafford February 23, 2011 at 5:52 AM    

Hi Admin, I try this code..but just 1 link open when i click.How to open three link with 1 link.can you help .

old_trafford February 23, 2011 at 6:17 AM    

hi admin i succesful for this trick.. this trick done when view in publish.. cannot work when in preview in draf..tq for this..

cd April 24, 2011 at 1:09 PM    

need help, i wan to make a pictures as link, after that if people click it, will open multiple links,

Greenlava April 24, 2011 at 1:45 PM    

@cd
Replace the Link Text with your picture source, i.e replace
"This anchor opens three links in a single click"
with:
[img src="PUT YOUR PICTURE URL HERE"]

Anonymous,  July 28, 2011 at 5:31 AM    

very good , but i Need to open them in the same window and in tabs,help

Greenlava July 31, 2011 at 6:30 PM    

@Anonymous
Whether they open in new windows or tabs depend on your browser setting.

mixse August 3, 2011 at 2:47 PM    

ok thanks for great post.i got it.its working now

dann,  August 20, 2011 at 7:23 PM    

hi is there a way to open this three webpage in an single page

Greenlava August 21, 2011 at 1:58 AM    

@danne.
I'm afraid that's not possible :(

Anonymous,  September 6, 2011 at 10:08 PM    

ok thanks for great post.i got it.its working now

Ifat November 30, 2011 at 11:14 PM    

thanks for this trick :)

Titanic Facts November 30, 2011 at 11:16 PM    

that's cool, really cool! I've never thought about this one. Now I can use it to use it on my blog to open more than one related site. thanks!!!!!!

ARS November 30, 2011 at 11:20 PM    

can i use it on frame?

sulthan December 24, 2011 at 2:43 AM    

salaam [ peace be upon you ]

superb.. tricks

Muhd Firdaus January 15, 2012 at 9:35 PM    

hi greenlava, can i know how to separate that onclick javascript with html alink? tq

Greenlava January 16, 2012 at 7:14 PM    

@Muhd Firdaus
Sorry but I don't quite get what you mean. Could you clarify?

Dieyna February 23, 2012 at 10:23 AM    

Thanks... It's working... Thanks a lot again...

Rahul Kashyap March 3, 2012 at 3:35 PM    

thanks good work

Virtual Books Library March 9, 2012 at 7:34 PM    

Thanks !

sania zara April 14, 2012 at 8:55 PM    

Hello, I love reading through your blog, I wanted to leave a little comment to support you and wish you a good continuation. Wish you best of luck for all your best efforts.by shahchats(java games)

rezki May 12, 2012 at 2:30 AM    

great code. it will help me to boost my page view blog. thanks bro

Anonymous,  May 14, 2012 at 8:26 PM    

very useful stuff.

lemonadeflirt May 15, 2012 at 12:35 PM    

hi greenlava i tried to put that html in blogger post but when i save it and click on it, it only opens a single window and when i tried to edit it again all html was gone rather than

href="http://bloggersentral.blogspot.com/" target="_blank">This anchor opens three links in a single click

please help

Greenlava May 17, 2012 at 9:11 PM    

@lemonadeflirt
The trick is to never switch to Compose mode after you put in the code.

Harfiz August 21, 2012 at 12:06 AM    

Nice one bro!

Are you Malaysian?
demo ore kelate ko? :D

Greenlava August 22, 2012 at 9:08 PM    

@Harfiz
Ho ore Kelate :)

cosmetic surgeon las vegas September 8, 2012 at 12:48 AM    

It's working on my firefox....post some scripts like this one !!!

WpShouter September 17, 2012 at 2:57 AM    

I badly need this for one of my projects. I'm so glad that i found it. Tnx mate for this :)

igedenurhadi.net September 20, 2012 at 5:24 PM    

thank for sharing, it's work for me

BonusChamp.com September 24, 2012 at 7:26 AM    

Thank you sir!

Anonymous,  October 22, 2012 at 9:16 AM    

good job

abhishek November 19, 2012 at 1:22 AM    

thank you sir i was searching for it .........

Indian Web Hosting November 30, 2012 at 5:12 PM    

Lots of days. I searching for open many urls in single link. Finally i got it from your help through this post. Thnk you sir...!

Anne ( USA ) February 7, 2013 at 2:03 AM    

Nice share, good information about hyperlinks.

Breaking News March 4, 2013 at 5:54 PM    

Normally i used urlopener.com or fur.ly.Both of these website are working perfect for me. Thanks for sharing your information too. :)

Edgar,  April 10, 2013 at 12:09 PM    

AWESOME Trick... question.. is there a way to make it so it works as a link? versus clicking on the text link..

for example I want to create a URL so when they click on it, it opens all 3 links on new window/tabs?

Vietnam Booking Tours April 24, 2013 at 7:13 PM    

Hi all.
if i want visitor click anything it will open new window on brower.
How do to do ?

Greenlava April 25, 2013 at 4:51 PM    

@Vietnam Booking Tours
Add a base tag in the head section of your template. Read about it here:
Opening a link in new window or tab

We love to hear from you! Leave us a comment.

To ensure proper display, HTML/XML/Javascript need to be escaped first using this escape tool. Then paste the escaped code here. For personalized help, you can HIRE ME.

Click to go to top Click to comment