Pasting image in Safari?

Hi,


I am trying to write the Javascript code to paste an image in Safari as it is already working with Chrome.


I get the paste event with a proper clipboardData containing the following:

files: FileList {0: File, length: 1, item: function}
types: ["public.file-url", "CorePasteboardFlavorType 0x6675726C", "dyn.ah62d4rv4gu8y6y4grf0gn5xbrzw1gydcr7u1e3cytf2gn", "text/uri-list", "Files", "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu", "com.apple.icns", "CorePasteboardFlavorType 0x69636E73", "fndf", "public.utf16-external-plain-text", …] (15)

and proceed with the image onloaded event but I always get a WebKitBlobResource error 4 (NOT_READABLE_ERR).

Also, when I try to paste after a Cmd-Ctrl-Shift-4 (with the image in the clipboard), the paste event clipboardData contains no data (here is the relevant part of the object):

files: FileList
  length: 0
types: ["public.png", "image/png", "public.tiff", "image/tiff"]


So, is there any way to paste an image in Safari and get the image with an image.onloaded event?

I use Safari 10.0.3 on macOS 10.12.3.


Thanks!


- Edouard