如何覆盖Chrome扩展程序中的下载过程 [英] How to override download process in Chrome Extension

查看:186
本文介绍了如何覆盖Chrome扩展程序中的下载过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Chrome浏览器中创建一个下载管理器扩展。我可以通过chrome.downloads API监控Chrome下载。但是,我想覆盖下载过程并使用扩展名而不是默认的saveFileDialog处理下载目标。有没有办法做到这一点?

解决方案

许多下载管理器都可以从商店中获得,所以它是可能的。其中一些是开源的,可以在github上找到,所以在开始自己的开发之前先看看。



如果你想用你自己的替换默认的下载管理器,你将需要使用许多提供的API,而不仅仅是 chrome.download




  • chrome.fileSystem 将允许处理文件系统
  • chrome.contextMenus 将允许添加另存为按钮

  • chrome.notifications 用于通知

  • chrome.downloads 可能允许拦截Chrome下载事件并重定向到您的扩展程序中。
  • chrome.storage
  • code>用于持久性数据
  • chrome.tabs +用于创建用户界面

  • more!...



JavaScript API记录在 here

祝你好运!


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?

解决方案

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!

这篇关于如何覆盖Chrome扩展程序中的下载过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆