The downloads API allows you to programmatically initiate downloads. In the future, you will also be able to monitor and manipulate downloads.

Manifest

The downloads API is currently experimental, so you must declare the "experimental" permission to use it. Also, you must specify the hostname of any URLs to be downloaded. For example:

{
  "name": "Download Selected Links",
  "description": "Select links on a page and download them.",
  "version": "0.1",
  "permissions": [
    "experimental", "http://*/*", "https://*/*"
  ]
}

If the URL’s hostname is not specified in the permissions, then the chrome.extensions.lastError object will indicate that the extension does not have permission to access that hostname. downloads.ERROR_* are some of the errors that may be returned.

Examples

You can find simple examples of using the downloads module in the examples/api/downloads directory. For other examples and for help in viewing the source code, see Samples.