downloads API. The background script starts and cancels downloads, and a popup lists live progress.
What you build
Manifest
manifest.json
Start and cancel downloads
Thefilename is relative to the browser’s downloads directory. Subfolders are allowed, absolute paths and .. segments are not.
background.js
pause, resume, and erase for full manager behavior.
Show progress in the popup
onChanged fires for state transitions, but it does not stream byte counts. Poll search() for items in progress and read bytesReceived and totalBytes from the results.
popup.html
popup.js
Can an extension download in parallel?
The browser owns the network queue, and an extension cannot change that. Chromium already runs several downloads at once but caps concurrent connections per server, and it queues the rest. An extension cannot raise those limits, and it cannot split one file into segments like a download accelerator. What an extension can do is orchestrate: start a batch with severaldownload() calls, watch onChanged, and start the next item when one completes. That gives you an ordered queue with progress, which is what most “parallel download” requests actually need.
Run it
Firefox notes
- Firefox supports the same API as
browser.downloadswith promises, and thechrome.downloadsalias also works. - Firefox does not support
chrome.downloads.setUiOptions, which hides Chrome’s download UI. - The
onChangeddelta shape and thesearch()query shape match across both browsers.
Start from a template
Theaction template ships the background plus toolbar-popup layout that this recipe uses.
Best practices
- Namespace filenames under one folder, so users can find your files.
- Stop the
setIntervalpoll when no download is in progress. - Handle
interruptedstate and surfaceitem.errorto the user. - Keep
saveAs: falseonly for files that the user explicitly requested. - Use
eraseto clean history entries, not to delete files.
Next steps
- Save recorded media with this API in Record the screen.
- Audit the
downloadspermission in the Security checklist. - Review Dev update behavior for popup reload rules.

