title: Export HTML table to Excel JavaScript function add select file name
body: <p>I have the following function that exports an HTML to excel:</p>
  
  <pre><code>function generateexcel(tableid) {
    var table= document.getElementById(tableid);
    var html = table.outerHTML;
    window.open('data:application/vnd.ms-excel,' + encodeURIComponent(html));
  }
  </code></pre>
  
  <p>The problem is that, i can't put a specific file name to save as so the user gets something like:</p>
  
  <p>Do you want to save %3Ctable%20id%3D%22tableRslts%22%20tabindex%3D%2235%22%20 file?</p>
  
  <p>And the saved file is like: </p>
  
  <p><code>IytvT8Jo.xls.part.xls</code> (at least in Firefox which is the target browser we will use)</p>
  
  <p>How would you fix this?</p>