gpt4 book ai didi

javascript - 使用 chrome.downloads.download,是否可以使文件不弹出下载栏?

转载 作者:行者123 更新时间:2023-11-30 08:00:49 58 4
gpt4 key购买 nike

当我执行 chrome.downloads.download 时, 它下载文件并弹出底部的下载栏并显示它,我可以抑制它吗?

例子:

/* some code to suppress download bar */

chrome.downloads.download(
{ "url": request.ImageToDownload },
function (downloadId){
// ...
}
);

最佳答案

是的,这是可能的。你可以fully suppress the download bar :

chrome.downloads.setShelfEnabled(boolean enabled)

Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.shelf" permission in addition to the "downloads" permission.

确保在完成后恢复它。此功能的想法是允许您构建一个自定义 UI 来替换货架。

关于javascript - 使用 chrome.downloads.download,是否可以使文件不弹出下载栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28752268/

58 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com