Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chrome 26, mac-only issue with Drag And Drop and DataTransfer: can't access "text/html"

I'm developing a web-app using the Drag-and-Drop API to collect resources from various websites.

With this API, I intend to parse the HTML of dragged resources to get the URLs of links and texts and images in the links.

It works fine on Firefox 19 (both Windows and Mac). It used to work on Chrome 25, but since the latest update, it doesn't work on Chrome for Mac 26, though it works on Windows.

Here's a snippet of the code I'm using -- you can try it on jsfiddle: http://jsfiddle.net/rYcyP/

document.getElementById("destination").addEventListener("dragover", function(_event) {
    _event.stopPropagation();
    _event.preventDefault();
}, false);
document.getElementById("destination").addEventListener("drop", function(_event) {
    _event.stopPropagation();
    _event.preventDefault();
    console.log(Array.prototype.slice.call(_event.dataTransfer.types));
}, false);

When dragging a link embedding an image, for example from a news website (or the ad above in Stack Overflow, or my gravatar), this is what the console reads in Firefox :

["text/x-moz-url", "text/x-moz-url-data", "text/x-moz-url-desc", "text/uri-list", "text/_moz_htmlcontext", "text/_moz_htmlinfo", "text/html", "text/plain", "application/x-moz-nativeimage", "application/x-moz-file-promise", "application/x-moz-file-promise-url", "application/x-moz-file-promise-dest-filename", "Files"]

This is much more data than I really need, but the text/html is here !

In Chrome 26.0.1410.43 Windows:

["text/plain", "text/uri-list", "text/html", "Files"]

Still good for me.

And here's what I get with Chrome 26.0.1410.43 on MacOS X :

["text/uri-list"]

Which doesn't include the "text/html" I need for my web app.

Thanks in advance for your help !

like image 279
raphv Avatar asked Nov 26 '25 07:11

raphv


1 Answers

Yes, I screwed this up. This is fixed in Chrome 28, and I merged the fix back to Chrome 27, so you should be seeing the fix in the next update. Chrome 26 is closed to all updates that aren't security-critical, so I can't push it back to that one.

Sorry for the hassle. Hang in there and it should start working again.

like image 122
Avi Avatar answered Nov 27 '25 21:11

Avi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!