14

When I do this in dragstart event:

e.dataTransfer.setData('text/plain', 'text');
e.dataTransfer.setData('text/html', 'html');
e.dataTransfer.setData('application/x-bookmark', 'bookmark');

and this in drop event:

for (var i = 0; i < e.dataTransfer.types.length; i++) {
   var type = e.dataTransfer.types[i];
   console.log(type + ":" + e.dataTransfer.getData(type));
}

I was supposed to have:

text/plain:text
text/html:html
application/x-bookmark:bookmark

as what I got in FF, but actually I got:

Text:text
text/plain:text

in Chrome. Where are those data gone? Does this mean chrome did not implement the dataTransfer object properly? And what can I do about this?

I ran this in Chrome 4.0.266.0

skaffman
  • 398,947
  • 96
  • 818
  • 769
Shinjikun
  • 590
  • 1
  • 5
  • 13
  • 1
    Isn't Chrome 4 still beta? Did you try it on 3? – Kobi Dec 13 '09 at 09:50
  • Is that mimetype registered in the browser? – Noon Silk Jan 04 '10 at 07:40
  • what is the result if you try Safari(webkit)? – Tommy Jan 04 '10 at 11:08
  • I don't know about Safari, but [Arora](http://arora.googlecode.com/) version 0.10.2 (WebKit version 533.3) does not have this bug. See also my related answer in another question: http://stackoverflow.com/questions/6767128/what-format-mime-type-should-i-use-for-html5-drag-and-drop-operations/6794282#6794282 – Denilson Sá Maia Jul 22 '11 at 18:27

1 Answers1

8

Yes it is a bug in Chrome. See issues 31037 and issue 30240 in the chromium issue tracker (chromium is the open source version of google chrome). I see no other solution than waiting for the bug to be fixed. You can help them fixing it by providing a simple test case.

Fabian Jakobs
  • 28,815
  • 8
  • 42
  • 39