html - JavaScript save text to file with spaces -


javascript

function savetextasfile() {     var texttowrite = document.getelementbyid('out').innerhtml;     var textfileasblob = new blob([texttowrite], {type:'text/plain'});     var filenametosaveas = document.getelementbyid("maze").value;      var downloadlink = document.createelement("a");     downloadlink.href = window.webkiturl.createobjecturl(textfileasblob);     downloadlink.download = filenametosaveas;     downloadlink.click();     } 

i'm trying here save text <pre id="out"></pre> .txt file, function doesn't save spaces , line-spaces <pre> tag, can see 1 long line in new .txt file. i'm missing here?

<pre> contains '\r\n'


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -