HTML and CSS Reference
FIguRE 8.3 Dragged content
from my web page creates a
desktop text snippet.
One final note about setData : It only accepts strings. This means
type. However, there's an easy enough solution around this:
All the latest browsers ship with native JSON encoding ( stringify )
and decoding ( parse ), so you can stringify our complex object
and set it against a content type. For the older browsers you can
include the JSON library from https://github.com/
douglascrockford/JSON-js which will plug support for
JSON stringify and parse .
Problems with setting drag data
Native desktop applications have had drag and drop for some
time now and have had years to get the APIs right. One huge
advantage that native applications have is that the setting of
data doesn't actually happen, or execute, when the user starts
dragging. It happens when the user drops.
There is an important reason for this: When you drop, you need
only one content type.