This article needs a technical review. How you can help.
The DataTransferItem
object represents one drag data item. During a drag operation, each drag event
has a dataTransfer
property and that property is a list
of drag data items. Each item in the list is a DataTransferItem
object.
This interface has no constructor.
Properties
DataTransferItem.kind
Read only- The kind of drag data item such as a
string
or afile
. DataTransferItem.type
Read only- The drag data item's type, typically a MIME type.
Methods
DataTransferItem.getAsFile()
- Returns the
File
object associated with the drag data item (or null if the drag item is not a file). DataTransferItem.getAsString()
- Invokes the specified callback with the drag data item string as its argument.
Example
All of this interface's methods and properties have their own reference page, and each reference page has an example of its usage.
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'DataTransferItem' in that specification. |
Living Standard | |
HTML5.1 The definition of 'DataTransferItem' in that specification. |
Working Draft | Not included in W3C HTML5 Recommendation |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 4 | No support | No support | 12 | No support |
Feature | Android | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | No support | No support | No support | No support | No support | No support | No support | No support |