When I try to write a line with several lines to the output text file, newline characters are not saved and all the contents are printed on one line.
In specific, I have a button with a listener on click with the corresponding function:
function (e) { this.downloadButton.setAttribute("download", "output.txt"); var textToSend = string1+"\r\n"+string2+"\r\n"+string3; this.downloadButton.setAttribute('href', 'data:text/plain;charset=utf-8,' + textToSend); }
The file is loaded correctly, but string1, string2 and string3 are on the same line.
Any suggestion?
source share