我正在使用純Javascript開(kāi)發(fā)文本編輯器。我想要這樣,以便當(dāng)用戶單擊“保存”按鈕時(shí),編輯器將下載文件。我已經(jīng)部分工作了:uriContent = "data:application/octet-stream," + encodeURIComponent(codeMirror.getValue());newWindow=window.open(uriContent, 'filename.txt');該文件已下載,但問(wèn)題是該文件名為“ download”。問(wèn)題:如何將文件名更改為所需的任何名稱,例如filename.txt?
用文件名保存文件Javascript
BIG陽(yáng)
2019-09-24 16:40:38