有没有办法在
期间或之后中止/阻止文件保存对话框chrome.downloads.onDeterminingFilename.addListener(function (item, suggest) {
suggest({
filename:item.filename,
conflict_action: 'prompt',
conflictAction: 'prompt'
});
// conflict_action was renamed to conflictAction in
// https://chromium.googlesource.com/chromium/src/+/f1d784d6938b8fe8e0d257e41b26341992c2552c
// which was first picked up in branch 1580.
});
答案 0 :(得分:1)
使用chrome.downloads.cancel
:
chrome.downloads.onDeterminingFilename.addListener(function (item, suggest) {
suggest({
filename:item.filename,
conflict_action: 'prompt',
conflictAction: 'prompt'
});
if(true) { // your cancel condition
chrome.downloads.cancel(item.id);
}
});
是的,您仍然需要拨打suggest
,因为只有正在进行的项目可能会被取消。