0

I have this code

 var link = document.createElement("a");
    document.body.appendChild(link);
    link.download = initCaps(obj.tableId) + '.csv';
    link.href = event.data;
    link.click();
    link.remove();

Link html :

<a href="data:text/csv;charset=UTF-8,%EF%BB%BF;Empresa;Utilizador;Projeto;Tarefa;Local;Dt.%20In%C3%ADcio;Dt.%20Fim;%C3%82mbito;Fatur%C3%A1vel;Dura%C3%A7%C3%A3o;Minutos;Kms;Descri%C3%A7%C3%A3o;Estado;%0A;CMIP;PMA;QUAD-HR;Levantamento%20necessidades;Lousado;2017-09-22;2017-09-27;Consultoria;Sim;00:06;6;6;66666;Validado;%0A;CMIP;PMA;QUAD-HR;
..........
download="Timesheets.csv"></a>

this works fine in chrome and firefox but not on Edge. Everything is fine but click dont work. File is not downloaded.

Leonel Matias Domingos
  • 1,922
  • 5
  • 29
  • 53
  • https://developer.microsoft.com/en-us/microsoft-edge/platform/status/adownloadattribute/ & https://stackoverflow.com/a/18408028/789213 – Garfield Oct 23 '17 at 09:34

1 Answers1

2

First of all your Edge should be of version 13 or greater for download attribute to work. Secondly, Please see below links Download attribute on A tag not working in IE

Asmarah
  • 134
  • 8