Safari on Mac HTML5 Drag and Drop event.dataTransfer.getData ('text / html') is empty

The name says it, but to see it in action, open this script in Safari on Mac - https://jsfiddle.net/ep2z5/6/

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

However, this is not the case in Safari. In safari, I can only name event.dataTransfer.getData( 'text' ), and it just gives me the URL. Which probably will work fine if I want to drag and drop tags <img />. However, I need to be able to drag <a><img /></a>and drop the tags , and when I do this, I get the attribute value hrefand no image information.

It seems that this may be a mistake, but I have not found any information about this anywhere.

Interestingly, if I drag an image from Chrome to Safari, then it works fine - draw a shape ...

I thought this might be a protocol issue (https vs http), but you can reproduce the problem in a violin - this is literally the same document.

+4
source share

Source: https://habr.com/ru/post/1672592/


All Articles