Join Bill Weinman for an in-depth discussion in this video Detecting drag-and-drop support, part of HTML5: Drag and Drop in Depth.
One of the first things you're going to want to do when coding for HTML5 drag…and drop is detect whether or not the browser supports the API. Because the API…for HTML5 drag and drop is event-based there is no specific window object method…to test for in order to detect support for drag and drop.…So instead we have to test for the draggable property, which should be…available on every element.…So we come over here to our text editor and I'm going to scroll down here and…show you this whole file so that you've got that, and there it is.…
It's pretty small and straight-forward. You'll notice here this function…detectDragAndDrop, and this is a little bit more complicated than it…otherwise would need to be.…You'll notice this line down here, if ('draggable' in…document.createElement('span')) return true, and so what that does is it tests…if when you create an element called span, which would be a normal span element…for an HTML document, if the resulting object has a property called draggable.…
- Detecting drag and drop support
- Using the HTML5 draggable and dropzone attributes and onDragStart event
- Exploring different events
- Receiving drops with or without a drop zone
- Creating a simple game