title: How to rename downloaded files from window.open() in javascript?
body: <p>I recently stumbled upon <a href="https://jsfiddle.net/lesson8/jWAJ7/" rel="nofollow noreferrer">this JSFiddle about how to convert a table to Excel</a> file directly without any fancy plugins. It really suits my need, but it has a flaw, I can't rename its file. Chrome renames the file to <code>download</code> and Firefox gives a random name to it.</p>
  
  <pre><code>$("#btnExport").click(function (e) {
      window.title = "filename.xls"; // this part doesn't work
      window.open('data:application/vnd.ms-excel,' +     
      $('#dvData').html());
      e.preventDefault();
  });
  </code></pre>
  
  <p>How can I rename the downloaded file ?</p>