1

To capture download Event using a chrome extension, I can use in my background.js the event chrome.downloads.onCreate.. can I have an example for that I couldn't find an example in the documentation ?

also, to capture Upload Event, As I read here, Is there any reliable way to capture file upload event in a chrome extension?

I can use chrome.webRequest.onBeforeRequest event but How? any example of code would be very helpful...

I managed to capture Upload Event from the DOM using by capturing input[type='file'] onChange Event, but that's not very efficient. I need to capture web requests and check for existance of a file there.

Thanks

var slctList = document.querySelectorAll("input[type='file']");
for(i=0;i<slctList.length;i++){

    slctList[i].addEventListener("change", function(){
               var files = e.files;
               var file = files[0];
               console.log(file.name);

            });
}

0 Answers0