How To Open Multiple Links/Windows With A Single Link

Hey when ever we visit any pages we find various links and all of these are clickable which are called Hyperlinks which are pointed to another web address that means as soon as we click on the link we are taken to a new URL and a new website or other part of the website opens.

Well but have you ever thought if it may be possible to open two different websites with a single Hyperlink?
Is it possible? Yes obviously it is possible with a very easy trick as i also needed this so i just applied this trick. So just follow the below process to open Two or More links with a single Hyperlink :-

METHOD 1 :-

First of all Create a Hyperlink with the below Code :-


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

In this code when you click the created link it will open your URL into the new tab.
Now the tricky part begins. 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;);"


So final link would 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>


So that is it. Now when ever you click on the link now it will open the both links in the new tab with a single link. Well if you want to open more then 2 links then just simply add the  window.open(); as shown above and create multiple links with a single links.

METHOD 2 :-

Just copy the below javascript below </head>


<script type='text/javascript'>
$('a.amit4ulink').click(function(e) { e.preventDefault(); window.open('http://yoururl1.com'); window.open('http://yoururl2.com'); });
</script>

In this script just replace or add as much URL's as you want to add.

And Now Simply add this line to your HTML :-

<a href="#" class="amit4ulink">Click Here</a>

That's it now you will see the links you have added in the <Script> section are opening with a single link.

You can see the example of such links by clicking the below link :-

EXAMPLE :- Click Here

So if you face any problem during applying this trick. then just comment below and we are here to solve your problem. Have fun. :)
 
Amit4u | All About EVERYTHING © 2013. All Rights Reserved. Modified by www.amit4uservices.com
Top