downloads.acceptDanger()

The acceptDanger() function of the downloads API prompts the user to either accept or cancel a potentially dangerous download.

This function can't be called from background scripts, only in scripts that are running in a visible window (such as a browser or page action's popup).

This is an asynchronous function that returns a Promise.

语法

js
let prompting = browser.downloads.acceptDanger(
  downloadId      // integer
)

参数

downloadId

一个 integer 代表所讨论的 DownloadItemid

返回值

一个 Promise。当对话框关闭时,该 Promise 将在没有参数的情况下完成。

浏览器兼容性

BCD 表格仅在启用 JavaScript 的浏览器中加载。

注意: 此 API 基于 Chromium 的 chrome.downloads API。