HTML5 Drag and Drop getData() only works on drop event in Chrome?

前端 未结 2 975
一生所求
一生所求 2020-12-30 23:56

I\'m currently working on a project at work using the HTML5 Drag and Drop API to provide added functionality including dragging items in and out of browsers. I am currently

相关标签:
2条回答
  • 2020-12-31 00:20

    WebKit, and hence Chrome, is quite restrictive on when you can call getData. You're not allowed to do it inside dragstart or dragover. I think this is the canonical bug.

    0 讨论(0)
  • 2020-12-31 00:31

    Referencing this answer:

    The data is only available on drop, this is a security feature since a website could grab data when you happen to be dragging something across the webpage.

    0 讨论(0)
提交回复
热议问题