Why does exporting HTML table data to Excel using JavaScript work in Firefox but fail in Chrome?

Chrome and Firefox handle data URLs differently. Firefox’s window.open() with a data: URL triggers the Open with Excel dialog nicely.

But Chrome treats it as a direct download with no filename or extension, so you just get a raw file without the .xls extension or prompt.

To fix this, you need to explicitly create a downloadable file with the right name and MIME type instead of just opening a data URL.

Using an anchor tag with a download attribute and a Blob usually does the trick across browsers.