title: How to generate and download multiple files at once with javascript (jsPdf) and firefox?
body: <p>I'm using JsPDF to generate a number of PDF files and then download them. With Chrome and Edge it's correctly generating and downloading all of them, but with Firefox is downloading only the first one. </p>
  
  <p>This is my code: </p>
  
  <pre><code>&lt;script&gt;
      $( document ).ready(function() {
          let doc = new jsPDF();
          doc.text(20, 20, 'hello');
          for(a = 0; a &lt; 6; a++){
              // doc.output('dataurlnewwindow');  &lt; NOT WORKING ON RECENT BROWERS.
              // doc.output('datauri');
              // doc.addHTML($('#content'), 1, 1, function () {
              //     var blob = doc.output("blob");
              //     window.open(URL.createObjectURL(blob));
              // });
  
              doc.save('file_number_' + 'a' + '.pdf'); &lt; DOWNLOADS ONLY THE FIRST FILE IN FIREFOX.
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>How could I be able to download all the generated files? It would be OK even if I could open them in a new window, as long as I'm able to specify the filename of the PDF.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: as indicated by pytness, it appears Firefox is blocking the process.
  I just tried to delay the clicks in this way: </p>
  
  <pre><code>function clickAll(){
              let waiter = 0;
              $('.pdf_line').each( 
                  function(){
                      if ($(this).find('input').prop('checked')){
                          //console.log('click! waiter = ' + waiter);
                          $(this).find('.print_document').delay(4000*waiter).click(); 
                          waiter++;
                      };
                  }
              )
          }
  </code></pre>
  
  <p>But after the first download Firefox halts the whole process.</p>