How to override download process in Chrome Extensi

2019-09-19 06:25发布

问题:

I am trying to make a download manager extension in chrome browser. I can monitor chrome downloads via chrome.downloads API. But, I want to override the download process and handle download destination with my extension instead of default "saveFileDialog". Is there any way to do so?

回答1:

Many download managers are available from the store, so it is possible. Some of them are open-source and available on github, so have a look before starting your own.

If you want to replaces the default download manager by your own, you will need to use many of the APIs that are provided, not only chrome.download!

  • chrome.fileSystem will allow handing the filesystem
  • chrome.contextMenus will allow adding your "save as" button
  • chrome.notifications for notifications
  • chrome.downloads may allow to intercept chrome downloads event and redirect to your extension
  • chrome.storage for persistent data?
  • chrome.tabs + more to create your user interface
  • more!...

The Javascript APIs are documented here.

Good luck!