I needed to determine if the file was being dragged to the browser from the outside, and also that the image was being dragged from the browser window. I did this by listening to dragstart in the document . When a file is dragged into the browser from the outside, dragstart does not start. So, if it works, it means that something inside one page is being dragged.
document.addEventListener('dragstart', function() { samePageDrag = true; }, false); document.addEventListener('dragend', function() { if (samePageDrag) { samePageDrag = false; } }, false);
In doing so, you can check the samePageDrag value after the dragenter or dragover event to determine if the item is being dragged outside the browser or not.
source share