How to make a link open multiple pages when clicked

I have two (or more) links. For example: and

How can I make them both open when I click on a single link?

For example, a link entitled "click here" which, when clicked, will open two different blank windows.



I did it in a simple way:

    <a href="" onclick="'');
return true;">multiopen</a>

It'll open runningrss in a new window and virtual-doctor in same window.


You can open multiple windows on single click... Try this..

<a href="http://--" 
     'http://--','','width=700,height=500'); ..// add more"
               >Click Here</a>`

I created a bit of a hybrid approach between Paul & Adam's approach:

The link that opens the array of links is already in the html. The jquery just creates the array of links and opens each one when the "open-all" button is clicked:


<ul class="links">
<li><a href=""></a></li>
<li><a href=""></a></li>

<a id="open-all" href="#">OPEN ALL</a>


$(function() { // On DOM content ready...
    var hrefs = [];

    $('.links a').each(function() {
        hrefs.push(this.href); // Store the URLs from the links...

    $('#open-all').click(function() {
        for (var i in hrefs) {
  [i]); // ...that opens each stored link in its own window when clicked...

You can check it out here:


If you prefer to inform the visitor which links will be opened, you can use a JS function reading links from an html element. You can even let the visitor write/modify the links as seen below:

<script type="text/javascript"> 
    function open_all_links() {
        var x = document.getElementById('my_urls').value.split('\n');
        for (var i = 0; i < x.length; i++)
            if (x[i].indexOf('.') > 0)
            if (x[i].indexOf('://') < 0)
      'http://' + x[i]);

<form method="post" name="input" action=""> 
    <textarea id="my_urls" rows="4" placeholder="enter links in each row..."></textarea>
    <input value="open all now" type="button" onclick="open_all_links();">

You need to unblock the pop up windows for your browser and the code could work.


Chrome browser setting



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


$('a.yourlink').click(function(e) {
}); also can take additional parameters. See them here:

You should also know that is sometimes blocked by popup blockers and/or ad-filters.

Addition from Paul below: This approach also places a dependency on JavaScript being enabled. Not typically a good idea, but sometimes necessary.


You might want to arrange your HTML so that the user can still open all of the links even if JavaScript isn’t enabled. (We call this progressive enhancement.) If so, something like this might work well:


<ul class="yourlinks">
    <li><a href=""></li>
    <li><a href=""></li>


$(function() { // On DOM content ready...
    var urls = [];

    $('.yourlinks a').each(function() {
        urls.push(this.href); // Store the URLs from the links...

    var multilink = $('<a href="#">Click here</a>'); // Create a new link... {
        for (var i in urls) {
  [i]); // ...that opens each stored link in its own window when clicked...

    $('.yourlinks').replaceWith(multilink); // ...and replace the original HTML links with the new link.

This code assumes you’ll only want to use one “multilink” like this per page. (I’ve also not tested it, so it’s probably riddled with errors.)


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.