IE 10 drag and drop upload gives empty dataTransfer

落爺英雄遲暮 提交于 2020-02-29 07:17:07

问题


I have some drag and drop upload code that isn't working properly in IE 10. My event handlers look something like this:

dragCatcher.on('drop', function (e) {
  e.preventDefault();
  e.stopPropagation();
  console.log(e.originalEvent.dataTransfer.files);
}).on('dragenter', function (e) {
  e.preventDefault();
  e.stopPropagation();
}).on('dragleave', function (e) {
  e.preventDefault();
  e.stopPropagation();
}).on('dragover', function (e) {
  e.preventDefault();
  e.stopPropagation();
  console.log(e.originalEvent.dataTransfer.types);
});

Both console.log's come up with undefined. I can confirm it's not a console bug, as e.originalEvent.dataTransfer.files[0] comes up with an error. I'm sure I'm missing something obvious, but I can't seem to figure it out.


回答1:


I had the same problem today. After 5 hours debugging, I found this from my<head>

<meta http-equiv="X-UA-Compatible" content="IE=9" />

After I change it to IE=10, problem solved. (Make sure you restart your IE)

Hopefully, this can solve your problem too.



来源:https://stackoverflow.com/questions/17935179/ie-10-drag-and-drop-upload-gives-empty-datatransfer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!