I\'am trying to download temporary result calculated by JavaScript. Say I have a string str, I want to download a file contains str and named it as
str
A shorter version of accepted one (for my case had to use unicode)
var link = document.createElement("a"); link.href = 'data:text/csv,' + encodeURIComponent("algún texto"); link.download = "Example.csv"; link.click();