File URL drops in Safari Extension

I need to retrieve complete file URLS when dropping files onto an html div in Safari. Would a Safari Extension be appropriate for this? The DataTransfer api allows for files to be dropped, but I would like to accept the drops and pass the URLS on to another process via http post request. I have seen this done in another web extension. Please provide a direction in the documentation.


Thanks,


Kolya

Replies

Where have you seen this done elsewhere? I would imagine that your needs could be handled by an extension content script, which is your extension's injected into web pages and run.


Check out https://developer.apple.com/documentation/safariservices/safari_app_extensions/injecting_a_script_into_a_webpage?language=objc

I was looking at IBM Aspera's plugin and they have a means of grabbing the complete url of a file a drop's datatransfers items. The feature is also available in Chrome. I looked at the docs. I didn't see anything relevant. Somehow to the datatransfer datat structure is fully populated when the user drags a file/folder onto a div.


Is the dragging pasteboard accessible from a safari extension?