KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm starting to experiment with HTML5 Drag and Drop. Then, in the dragstart event handler we should run setData() , which receives two parameters: format and data . function dragstart_handler(ev) { ev.dataTransfer.setData('text/plain', 'foobar'); } I want to drag some kind of "object" from one container into another container, inside my web application. By "object", I mean something that has multiple attributes (color, text, author, date, …). What kind of format (or MIME Type) should I use? text/plain ? text/x-myapp-myobjtype ? application/x-myapp-myobjtype ? application/x-myapp.myobjtype+json ? something else? more than one? How should I encode my object (the data parameter of setData() )? Comma-separated (or any other delimiter) key=value pairs? Serialize the object using JSON? Just an id, and at the dropzone I must retrieve the full object using just the id? Send just a reference to the object, without even serializing anything? (not possible, the data argument must be a string) (I realize that "How to enconde an object for Drag and Drop" could be another question here, but it is closely related to the choice of MIME Type) Some references: http://dev.w3.org/html5/spec/dnd.html http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd https://developer.mozilla.org/En/DragDrop/Drag_Operations <a href="https://developer.mozilla.org/En/DragDrop/DataTra
Tags (comma-separated)
Save Edits
Cancel