I am writing a Chrome extension to intercept the drop
event and analyze the files being dropped, using Event.DataTransfer
, and re-trigger the drop event with a modified file list.
Am I doing this right, or is there any other way to achieve this?
<code>function dropHandler(Event)
{
//Collect the files from Event.DataTransfer
//Send it to background.js
//prevent Default
//Stop the Propagation()
}
onMessage.addListener((request, sender, sendResponse) =>
{
//Create a new Drop Event.
//Updates the DataTransfer with the file list
//Trigger the drop event.
});
</code>
<code>function dropHandler(Event)
{
//Collect the files from Event.DataTransfer
//Send it to background.js
//prevent Default
//Stop the Propagation()
}
onMessage.addListener((request, sender, sendResponse) =>
{
//Create a new Drop Event.
//Updates the DataTransfer with the file list
//Trigger the drop event.
});
</code>
function dropHandler(Event)
{
//Collect the files from Event.DataTransfer
//Send it to background.js
//prevent Default
//Stop the Propagation()
}
onMessage.addListener((request, sender, sendResponse) =>
{
//Create a new Drop Event.
//Updates the DataTransfer with the file list
//Trigger the drop event.
});
Unfortunately, the drop event is getting triggered but the file is not getting attached to the website.
New contributor
Imdev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.