Can I have an HTML drag-and-drop input in Microsoft Edge?

☆樱花仙子☆ 提交于 2019-11-27 01:38:08

问题


We are adapting our product to Microsoft Edge. We have an HTML drag-and-drop feature that works correctly in IE, Chrome, etc.

Using Microsoft Edge from Win10 Insider Preview Build 10162, the drop is forbidden. We also checked http://html5demos.com/dnd-upload doesn't work neither.

Has anyone solved this problem?


回答1:


Microsoft implemented this feature in EdgeHTML 13, included in Windows 10 Build 10586 (November 2015).


Original answer:

The DragAndDropEntries is not supported in Microsoft Edge yet. See this link for more detail

It says:

Allows dragging and dropping entire folders using HTML5 Drag and Drop. Extends the DataTransferItem with a method to get a FileEntry/DirectoryEntry. Roadmap Priority: Low — We are still evaluating this technology. There may be significant spec stabilization, foundational work, or additional community input required before we can begin development."

However, feel free to request for this feature at https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer




回答2:


I just tried it the demo on Microsoft Edge and it worked fine for me.




回答3:


Worked for me:

html:

<input
    id = "dropzone"
    accept = "image/*"
    multiple = "false"
    type = "file"
/>

used javaScript 'drop' event :

const dropzone = document.getElementById('dropzone');

dropzone.addEventListener('drop', (event) => { /* your callback */ })

to get file used:

event.dataTransfer.files[0]


来源:https://stackoverflow.com/questions/31649569/can-i-have-an-html-drag-and-drop-input-in-microsoft-edge

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