I'm currently working on a tool that incorporates file drag and drop functionality. Strangely, this feature works perfectly in all browsers except for Chrome. Surprisingly, however, it does work in Chrome when the tool is run locally.
Here is the code snippet I am using to define the events:
document.ondragenter =
document.ondragleave = dragenterDragleave;
document.ondragover = function(evt) { evt.preventDefault() };
document.ondrop = drop;
After executing the script, the events should be defined. However, I noticed that Chrome continues to process other parts of the code which eventually leads to the removal of the events. This behavior has left me puzzled as to why it is happening.
Edit| Upon further investigation, I discovered that this issue is not unique to my computer alone. Some of my friends who use Chrome have also experienced the same problem. Although it could be related to an extension running in their browser, this should not be causing the issue.
I suggested to my friends to temporarily disable ad blockers, and surprisingly, this seemed to resolve the problem for them.