I'm trying to create and download a file on client side with the following code:
function downloadFile(filename, text) {
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
pom.setAttribute('download', filename);
pom.click();
}
Although this only works on chrome. Nothing happens on safari and IE. How can I make it work?