In this article downloads on MDN, it says we can use downloads api to donwload a file, but code in the example of that article
var downloading = browser.downloads.download({
url : downloadUrl,
filename : 'my-image-again.png',
conflictAction : 'uniquify'
});
downloading.then(onStartedDownload, onFailed);
will lead to Uncaught ReferenceError: browser is not defined.
I ran this code in chrome console pannel. Did I miss something?
Look at the section of the MDN documentation that page appears in. The feature is only available to browser extensions, not to regular webpages (which is the context the Console runs in if you open it against a regular page).

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With