Anchor tag download attribute not working :Bug in Chrome 35.0.1916.114

So you should change this:

// Data URI
csvData="data:application/csv;charset=utf-8," + encodeURIComponent(csv);

$(this)
    .attr({
    'download': filename,
        'href': csvData,
        'target': '_blank'
});

To This

// Data URI
//csvData="data:text/csv;charset=utf-8," + encodeURIComponent(csv), //old way
blob = new Blob([csv], { type: 'text/csv' }); //new way
var csvUrl = URL.createObjectURL(blob);

$(this)
.attr({
    'download': filename,
    'href': csvUrl
});

And it should work!

Leave a Comment