function onStartedDownload(id) {
console.log(`Started downloading: ${id}`);
}
function onFailed(error) {
console.log(`Download failed: ${error}`);
}
let downloadUrl = "https://example.org/image.png";
let downloading = browser.downloads.download({
url: downloadUrl,
filename: "my-image-again.png",
conflictAction: "uniquify",
});
downloading.then(onStartedDownload, onFailed);downloads.download() / notebook
downloads.download()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.