Note that there are some explanatory texts on larger screens.

plurals
  1. POSafari 5.1 broke HTML native drag and drop?
    text
    copied!<p>Last night, I thought I'd do a quick project to demonstrate HTML5 capabilities and to try some things out. However, I can't seem to figure out how to get drag and drop to work in Safari, while it works perfectly in Chrome and Firefox. More precisely, it seems that drop event does not fire in Safari, when you try to drag an image inside the website into the drop area. At the same time it does fire when you drag and drop a file from desktop.</p> <p>I'm not really sure, but I'm pretty certain that when I tried the same script at work (where I have Safari 5.0.2 etc), it fired the drop event (going to check it tomorrow to be sure) and gave me the FileReader-related errors that were expected. But when I just installed Safari 5.1 on my own PC, I only get dragover, enter and leave events (and drop too if the file was dragged into the browser).</p> <p>I've been Googling for some time now and don't seem to find a single example of drag and drop that actually works in Safari 5.1. Even Safari's <a href="http://developer.apple.com/library/mac/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/DragAndDrop.html" rel="noreferrer">dev-centre's sample</a> doesn't work, let alone <a href="http://html5demos.com/drag" rel="noreferrer">html5demo.com 1</a> and <a href="http://html5demos.com/drag-anything" rel="noreferrer">html5demo.com 2</a>. This leads me to think whether the Safari has a bug, or maybe they have implemented something mandatory that isn't reflected in the dev-centre (last updated in 2009).</p> <p>The script I'm trying to fix is at <a href="http://www.ut.ee/~vahurr/memebuilder" rel="noreferrer">my site</a> (sorry guys, no problem specific code to post, as it seems to be broken elsewhere too).</p> <p>PS! I might have introduced some bugs into my own site while desperately trying to fix the drag and drop in Safari, but I'm too tired to fix them right now.</p> <p><strong>UPDATE:</strong> Just confirmed at work that the drop event does fire in Safari 5.0.2 on Mac OS X.</p> <p><strong>UPDATE 2:</strong> Also confirmed that everything works perfectly fine with Safari 5.0.6 on Win 7, the same computer that fails with 5.1</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload