186
rated 0 times
[
191]
[
5]
/ answers: 1 / hits: 121252
/ 13 Years ago, mon, october 10, 2011, 12:00:00
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:
uriContent = data:application/octet-stream, + encodeURIComponent(codeMirror.getValue());
newWindow=window.open(uriContent, 'filename.txt');
The file downloads, but the problem is that the file is named 'download'.
Question: How could I change the name of the file to be anything I want, e.g filename.txt
?
More From » javascript