A common way to export a table from JS to an Excel file is to call: ActiveXObject("Excel.Application"), but this method has limitations and can only be implemented in browsers under the IE series, and the compatibility is not ideal.
After testing, the method recommended in this article can export table contents to Excel files with good compatibility.
var downloadLink = document.createElement("a");
downloadLink.href = uri;
downloadLink.download = "export.csv";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
So, for IE browser, I have to make a judgment and use ActiveXObject.
In this way, you can better use Javascript to export HTML content to Excel files.