Hmmm, what actually I have found. Such a definition like this one performs well. It performs in an appropriate way only with IE 10 and 11. I
var link = document.createElement("a");
link.setAttribute("id", id here);
link.setAttribute("href", URL here);
var NameToDownload = desired name here;
link.innerHTML = NameToDownload;
But if you prefer to have txt downloaded you'll see the file opened but not saved.
It should be somehow walked around...