Save file Javascript with file name
<p>I'm working on a text editor in pure Javascript. I'd like it so that when the user clicks the 'Save' button, the editor downloads the file. I've already got this partly working:</p>

<pre><code>uriContent = "data:application/octet-stream," + encodeURIComponent(codeMirror.getValue());
newWindow=window.open(uriContent, 'filename.txt');
</code></pre>

<p>The file downloads, but the problem is that the file is named 'download'. I'd like the downloaded file to be named 'filename.txt'.</p>
