6

I am creating a script that lets you download a CSV File of current table on the page like this:

var downloadLink = document.createElement("a");
var blob = new Blob(["", CSVString], {type: 'text/csv;charset=utf-8'});

if (navigator.appVersion.toString().indexOf('.NET') > 0) {
    window.navigator.msSaveOrOpenBlob(blob, "Daten.csv");
} 
else {
    downloadLink.href = window.URL.createObjectURL(blob);
    downloadLink.download = "Daten.csv";
    downloadLink.style.display = 'none';
    document.body.appendChild(downloadLink);

    downloadLink.click();
}

Now if I use IE it asks if I want to download a file from localhost, but in Mozilla Firefox the download window says "From: blob:". Can it be changed to show the host name or a name that I specify (e.g. Test)?

marcinstl
  • 65
  • 1
  • 8

1 Answers1

4

Pitifully there's no available solution till the date. The issue was reported a couple of years ago but it seems it has the minor importance level and no one is asigned to this issue.

The From label will always display from: blob::

enter image description here

No matter what you do.

Carlos Delgado
  • 2,930
  • 4
  • 23
  • 49
  • That's too bad... Is there any other method to make a downloadable file insted of using Blob? – marcinstl Aug 21 '17 at 10:07
  • Well, without blobs, JavaScript is not an option then. The only option you have is to create an endpoint in your server that returns the CSV file (e.g yourweb/download-table-csv), so the From source will be indeed your domain. You just can redirect to the user to the download URL: https://stackoverflow.com/questions/11620698/how-to-trigger-a-file-download-when-clicking-an-html-button-or-javascript – Carlos Delgado Aug 21 '17 at 10:16