问题
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