title: How to Download multiple files from javascript
body: <p><strong>I am trying to use window.location.href in a loop to download multiple files</strong></p>
  
  <p>I have a table in which i can select file's, then i run a loop of selected and 
  try navigate to the file path to download the files.</p>
  
  <p>I keep only getting the last file to download. </p>
  
  <p>I think it's due to the location herf only taking action after my javascript finishes and not as the code runs.</p>
  
  <p>When i have a break point on the window.location.herf it still only downloads the last file and only when i let the code run through.</p>
  
  <p>Is there a better way to initiate multiple downloads from a javascript loop.</p>
  
  <hr>
  
  <pre><code>$("#btnDownload").click(function () {
    var table = $('#DocuTable').DataTable();
    var rows_selected = table.rows('.selected').data();
    $.each(rows_selected, function (i, v) {
      window.location.href = v.FilePath;
    });
  });
  </code></pre>