Q:

export function to create a CSV file does not work in Chrome

I have created this function to export some data. It is a web application written in backbone.js. It is working fine in Firefox and IE the file which is downloaded has the extension .csv and is of Text (text/csv) but Chrome it does not have any extension in the properties of the file it says it is of the Text (text/plain) this also needs to be Text (text/csv) and with the .csv extension.
export: function (ev) {
    var blob = new Blob( [ ev.currentTarget.attributes.csv.nodeValue ], { type: "text/csv"} );
      if ( navigator.msSaveOrOpenBlob ) {
        navigator.msSaveOrOpenBlob( blob, "output.csv" );
    } else  {
        window.open( "data:text/csv;charset=utf-8," + escape(ev.currentTarget.attributes.csv.nodeValue), '_blank')
        return false;
    }
},

How can i accomplish this?

A:

this worked for me. Maybe it could be useful for somebody else
export: function (ev) {
        var blob = new Blob( [ ev.currentTarget.attributes.csv.nodeValue ], { type: "text/csv;charset=utf8;"} );
        console.log(999);
        if ( navigator.msSaveOrOpenBlob ) {
            navigator.msSaveOrOpenBlob( blob, "export.csv" );
        } else  {
            var link = document.createElement('a');
            link.href = URL.createObjectURL(blob);
            link.setAttribute('download', 'export.csv');
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
            return false;
        }
    },

