title: How to force Chrome to NOT open SaveAs Dialog when downloading a URL?
body: <p>Chrome Build: the newest, 33+</p>
  
  <p>A Chrome Extension extracts certain urls from currently viewed site and then downloads a subset of them (quite often hundreds of files).</p>
  
  <p><strong>Expected Behavior:</strong></p>
  
  <p>Files are downloaded into the default Download-Folder <strong>without</strong> questioning where and under which filename they have to be saved.</p>
  
  <p><strong>Problem:</strong></p>
  
  <p>If a user has enabled the option "Ask where to save each file before downloading" in Chrome->Settings->Advanced Settings->Downloads then when trying to download, for example, 100 files simultaniously, Chrome tries to open 100 SaveAs Dialogs and crashes.</p>
  
  <p><strong>What I tried:</strong></p>
  
  <ul>
  <li>to use chrome.downloads.download(object options, function callback) method with an option <strong>saveAs: false</strong></li>
  <li><p>using the following code to trigger a download through an emulated mousevent:</p>
  
  <pre><code>function saveAs(Url,filename){
    var blob=new Blob([''], {type:'application/octet-stream'}); 
    var url = webkitURL.createObjectURL(blob);
    var a = document.createElementNS('http://www.w3.org/1999/xhtml','a');
    a.href = Url;
    a.download = filename; 
    var e = document.createEvent('MouseEvents');
    e.initMouseEvent('click', false, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    a.dispatchEvent(e);
    webkitURL.revokeObjectURL(url);
  }
  </code></pre></li>
  </ul>