我一直在寻找一段时间,我找不到合适的答案.
基本上我有一个网页,允许用户输入一些值并根据输入的值下载特定文件.一切正常,但是,我想让用户选择保存文件的位置,而不是仅保存到默认下载位置的浏览器.
我正在使用follownig启动下载.
/**
* Get URL for data file and ensure user wants to download it
**/
function getResultDataHandler(result, messages) {
var dataURL = result.value.url;
var r = confirm("Save File?");
if (r == true) {
download(dataURL);
}
else {
console.log("Canceled");
}
showMessage("", true);
}
/**
* Open the download dialog
**/
function download(dataURL) {
console.log("downloading");
window.open(dataURL, 'Download');
}
Run Code Online (Sandbox Code Playgroud)