简体   繁体   English

通过Chrome扩展程序静默下载

[英]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. 我为chrome.downloads.download设置了saveAs:false ,这样我就不会出现saveAs对话框。 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. 这会使下载栏和Chrome界面混乱。

Is it possible to prevent download bar from opening and not put the downloads that are started by an extension? 是否可以防止打开下载栏,而不放置由扩展程序启动的下载?

It's possible to hide the download bar (called shelf in Chrome UI lingo) completely, but not filter out specific downloads. 可以完全隐藏下载栏(在Chrome UI术语中称为架子 ),但不能过滤掉特定的下载内容。

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

You can clear out your downloads from the download list with chrome.downloads.erase method . 您可以使用chrome.downloads.erase方法从下载列表中清除下载内容。

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. 考虑另一种(如果在技术上更具挑战性的)方法,即通过XHR“下载”到临时HTML5 FileSystem ,形成存档文件,然后在其上调用chrome.downloads May not work if you need all the files immediately unpacked. 如果您需要立即解压缩所有文件,则可能无法正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM