4

The title says most of it, but to see it in action, open this fiddle in Safari on a Mac - https://jsfiddle.net/ep2z5/6/

What happens in Chrome when I drag and drop an image(or a linked image) is that in my event handler, I can call event.dataTransfer.getData( 'text/html' ) and I would get the complete HTML of the dragged element.

However this is not the case in Safari. In safari, I can only call event.dataTransfer.getData( 'text' ) and this just gives me a URL. Which would probably work fine, if I wanted to drag plain <img /> tags. However I need to be able to drag <a><img /></a> tags and when I do, I get the value of the href attribute and no information about the image.

It seems like it could be a bug, but I haven't found information about it anywhere.

The interesting thing is that if I drag an image from Chrome into Safari, then it works fine - go figure...

I thought that this could be a problem of protocols(https vs http), but you can reproduce the issue in the fiddle - which is literally the same document.

Nikola Ivanov Nikolov
  • 5,022
  • 1
  • 26
  • 27
  • I can't seem to get the content even via `getData('text')`. Did you ever run into that @Nikola? Your fiddle doesn't work for me in Safari `11.0.2` – onassar Jun 10 '18 at 22:47

0 Answers0