Open multiple links / windows in a single click
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.)
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("YOUR_2nd_URL");"
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(""YOUR_2nd_URL""); window.open(""YOUR_3rd_URL"");">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("http://www.tourism.gov.my/"); window.open("http://www.tic.kelantan.gov.my/");">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"
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)
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!
Termite information,
I think FireFox have an addon specially for that. Try seacrh for it.
Logo Designs,
You're welcome
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.
Canada provinces,
Try Snap Links FireFox addon.
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
Perfect . I just found what i wanted to do ;) . Keep going towards success ...
@zahid
Thanks for the encouraging words :)
Good One..............
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.
@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!
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
@beads
Glad you've enjoyed it. There are a lot more tutorials here, you can easily find them using the search bar.
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 .
hi admin i succesful for this trick.. this trick done when view in publish.. cannot work when in preview in draf..tq for this..
need help, i wan to make a pictures as link, after that if people click it, will open multiple links,
@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"]
very good , but i Need to open them in the same window and in tabs,help
@Anonymous
Whether they open in new windows or tabs depend on your browser setting.
ok thanks for great post.i got it.its working now
hi is there a way to open this three webpage in an single page
@danne.
I'm afraid that's not possible :(
ok thanks for great post.i got it.its working now
thanks for this trick :)
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!!!!!!
can i use it on frame?
salaam [ peace be upon you ]
superb.. tricks
hi greenlava, can i know how to separate that onclick javascript with html alink? tq
@Muhd Firdaus
Sorry but I don't quite get what you mean. Could you clarify?
Thanks... It's working... Thanks a lot again...
thanks good work
Thanks !
great code. it will help me to boost my page view blog. thanks bro
very useful stuff.
@lemonadeflirt
The trick is to never switch to Compose mode after you put in the code.
Nice one bro!
Are you Malaysian?
demo ore kelate ko? :D
@Harfiz
Ho ore Kelate :)
It's working on my firefox....post some scripts like this one !!!
I badly need this for one of my projects. I'm so glad that i found it. Tnx mate for this :)
thank for sharing, it's work for me
Thank you sir!
good job
thank you sir i was searching for it .........
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...!
Nice share, good information about hyperlinks.
Normally i used urlopener.com or fur.ly.Both of these website are working perfect for me. Thanks for sharing your information too. :)
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?
Hi all.
if i want visitor click anything it will open new window on brower.
How do to do ?
@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
nice work dude..keep posting..
Thanks so much ,i was searching this trick for a very long time,i got it here,Thanks so much again.God bless you
Comments on this post are closed.