Anchor tag download attribute not working :Bug in Chrome 35.0.1916.114

后端 未结 6 1182
一整个雨季
一整个雨季 2020-11-29 04:21

I am trying to refer to this code where a we are downloading a CSV file on click of a link.

$(document).ready(function () {

    function exportTableToCSV($         


        
6条回答
  •  无人及你
    2020-11-29 05:08

    For me worked:

    var content = "some content";
    var link = document.createElement('a');
    var blob = new Blob(["\ufeff", content]);
    var url = URL.createObjectURL(blob);
    link.href = url;
    link.setAttribute('download', 'file.csv');
    link.click();
    

提交回复
热议问题