title: HTML table exported to .xls fails to open when using FireFox to download
body: <p>I am using a function that I found on here on stackoverflow.  It works fine on Internet Explorer and Google Chrome, but when used in FireFox, the downloaded file is unable to be opened in Excel.  When I double click it or open from Excel, it displays a blank workbook.  When I convert this downloaded file from .xls to .html, it opens properly in any browser previously mentioned.  </p>
  
  <p>Any ideas on what I am doing wrong and how to fix it?</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>function fnExcelReport(){
  var tab_text="&lt;table border='2px'&gt;&lt;tr bgcolor='#87AFC6'&gt;";
  var textRange; var j=0;
  var tab = document.getElementById('GroupMembersTable'); // id of table
  var sa
  for(j = 0 ; j &lt; tab.rows.length ; j++) 
  {     
      tab_text=tab_text+tab.rows[j].innerHTML+"&lt;/tr&gt;";
      //tab_text=tab_text+"&lt;/tr&gt;";
  }
  
  tab_text= tab_text+"&lt;/table&gt;";
  tab_text= tab_text.replace(/&lt;A[^&gt;]*&gt;|&lt;\/A&gt;/g, "");//remove if u want links in your table
  tab_text= tab_text.replace(/&lt;img[^&gt;]*&gt;/gi,""); // remove if u want images in your table
  tab_text= tab_text.replace(/&lt;input[^&gt;]*&gt;|&lt;\/input&gt;/gi, ""); // removes input params
  
  var ua = window.navigator.userAgent;
  var msie = ua.indexOf("MSIE "); 
  
  if (msie &gt; 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
  {
      txtArea1.document.open("txt/html","replace");
      txtArea1.document.write(tab_text);
      txtArea1.document.close();
      txtArea1.focus(); 
      sa=txtArea1.document.execCommand("SaveAs",true,"SecurityAudit.xls");
  }  
  else { //other browser not tested on IE 11
      sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));  
  }
  return (sa);
  }
  </code></pre>