javascriptgoogle-chromegoogle-chrome-extension

Downloading Silently by Chrome Extension


I need my extension to bulk download assess in a web page.

I set saveAs:false for chrome.downloads.download so that I do not get saveAs dialog. But when download starts, download bar at the bottom of the browser gets opened and all list of downloads puts into it. This clutters the download bar and Chrome interface.

Is it possible to prevent download bar from opening and not put the downloads that are started by an extension?


Solution

  • It's possible to hide the download bar (called shelf in Chrome UI lingo) completely, but not filter out specific downloads.

    chrome.downloads.setShelfEnabled(false); // requires "downloads.shelf" permission
    

    You can clear out your downloads from the download list with chrome.downloads.erase method.

    Consider an alternative (if more technically challenging) approach of "downloading" through XHR to a temporary HTML5 FileSystem, forming an archive file, and then calling chrome.downloads on that. May not work if you need all the files immediately unpacked.