HTML5 drag and drop between windows

Viewed 26434

is there anyway with the HTML5 Drag & Drop functionality or/and the File API to drag an jpg image from one window to another?

The idea is that I could drag and image from Facebook to a different browser's window with a custom HTML that would get that image.

Or, at least, a way to drag from the Desktop to a browser?

Thanks a lot

7 Answers

I know you can very easily get the URL of the image that was dragged: myDataTransfer.getData("Text")

but so far I haven't been able to find a way to retrieve the underlying image data without falling foul of cross-domain javascript security... you can't fetch the image using ajax, and you can't use a canvas as an intermediary either.

Unfortunately, it seems that in most cases, the drag itself (that is, the dataTransfer object) doesn't contain the image data. I say "most cases" because drags from within the same browser don't, but when I dragged from a Firefox window to a Chrome window, it seems to have included some kind of bitmap image, but it's in some unusual format (perhaps a Windows thing).

The only other thing to look at is browser-specific functionality, like "application/x-moz-nativeimage", but I don't see any similar property attached to the dataTransfer object in Chrome.

Related