简体   繁体   中英

No drag and drop events fired in IE11

I'm stuck with a problem in IE11.

The drag and drop events are not triggered in IE11. First I thought it has something to do with the IE settings (security>Allow drag drop).

I use jQuery, but it doesn't work with plain JavaScript as well.

I broke it down to the following piece of code:

    <script>
       document.addEventListener('dragenter', function (event) {
                alert("Dragenter");

            });
    </script>

When I drag a file from my desktop into the browser, the alert appears. It works fine with Chrome, Edge, Firefox, but not with IE.

Unfortunately it still doesn't work in my current project. Even the simple js snippet. Any Ideas?

I added my site to the trusted sites, enabled ActiveX, Enabled all other scripting settings, but it looks still like the Browser is blocking drag and drop actions for my site.

I've tested on my side and the alert appears successfully. 运行结果

I suggest that you could check the Drag and Drop feature in your IE.

  1. Go to Internet Options
  2. Go to Security tab
  3. Click on Custom level
  4. Search for Drag and Drop settings and Click on Enables
  5. Click Ok

Solved! The problem was, that i started my IE as an administrator (from Visual Studio).

It is not possible , to move files from your local users desktop, to an IE in administrator-mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM