有没有可靠的方法来捕获Chrome扩展程序中的文件上传事件? [英] Is there any reliable way to capture file upload event in a chrome extension?

查看:131
本文介绍了有没有可靠的方法来捕获Chrome扩展程序中的文件上传事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的内容脚本中,我想监视正在将哪个文件上传到Web应用程序.

In my content script, I want to monitor which file a is getting uploaded to a web application.

我监视任何"input:file"元素的"change"事件.它可以在使用"input:file"的任何站点(例如Gmail)上运行.

I monitor "change" event for any "input:file" element. It works on any site (such as Gmail) that uses "input:file".

不过,像imgur这样的网站都使用SWFUpload机制.我试图捕获怀疑为swfupload的元素上的"fileQueued"事件.但这是行不通的.

However sites like imgur, use SWFUpload mechanism. I tried to capture "fileQueued" event on element that I suspected to be swfupload. But that did not work.

  • 如何捕获使用swfupload的网站的文件上传事件?
  • 在内容脚本中还需要其他一些插件来管理文件上传吗?
  • 有没有通用的机制来解决这个问题?

(我知道拖放机制,但是到目前为止,我还没有处理过这种情况. 我还阅读了以下有关SO的相关问题:

(I am aware of drag-n-drop mechanism, but I have not handled that case so far. I have also read following relevant question on SO:

在上传前抓取具有chrome扩展名的文件)

推荐答案

尝试使用

It's probably worth your time to experiment with the chrome.webRequest API; it appears that the onBeforeRequest event contains info about file uploads. It's a complex API with extra parameters to addListener; read the docs thoroughly.

这篇关于有没有可靠的方法来捕获Chrome扩展程序中的文件上传事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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