The DataTransferItem object represents one drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object.
This interface has no constructor.
Properties
DataTransferItem.kindRead only- The kind of drag data item,
stringorfile. DataTransferItem.typeRead only- The drag data item's type, typically a MIME type.
Methods
DataTransferItem.getAsFile()- Returns the
Fileobject 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.
DataTransferItem.webkitGetAsEntry()'- Returns an object based on
FileSystemEntryrepresenting the selected file's entry in its file system. This will generally be either aFileSystemFileEntryorFileSystemDirectoryEntryobject.
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 |
| HTML Living StandardThe definition of 'DataTransferItem' in that specification. | Living Standard | Initial definition. |
| HTML 5.1The definition of 'DataTransferItem' in that specification. | Recommendation | W3C snapshot of WHATWG |
| File and Directory Entries APIThe definition of 'DataTransferItem.webkitGetAsEntry()' in that specification. | Draft | Definition of webkitGetAsEntry() as part of the File and Directory Entries API.
|
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
DataTransferItem
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 50 |
IE
No support No |
Opera
Full support 12 |
Safari
Full support 5.1 |
WebView Android
Full support 4 |
Chrome Android
Full support 18 |
Firefox Android
Full support 50 |
Opera Android
No support No |
Safari iOS
Full support 5 |
Samsung Internet Android
Full support 1.0 |
getAsFile
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 50 |
IE
No support No |
Opera
Full support 12 |
Safari
Full support 5.1 |
WebView Android
Full support 4 |
Chrome Android
Full support 18 |
Firefox Android
Full support 50 |
Opera Android
No support No |
Safari iOS
Full support 5 |
Samsung Internet Android
Full support 1.0 |
getAsString
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 50 |
IE
No support No |
Opera
Full support 12 |
Safari
Full support 5.1 |
WebView Android
Full support 4 |
Chrome Android
Full support 18 |
Firefox Android
Full support 50 |
Opera Android
No support No |
Safari iOS
Full support 5 |
Samsung Internet Android
Full support 1.0 |
kind
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 50 |
IE
No support No |
Opera
Full support 12 |
Safari
Full support 5.1 |
WebView Android
Full support 4 |
Chrome Android
Full support 18 |
Firefox Android
Full support 50 |
Opera Android
No support No |
Safari iOS
Full support 5 |
Samsung Internet Android
Full support 1.0 |
type
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 50 |
IE
No support No |
Opera
Full support 12 |
Safari
Full support 5.1 |
WebView Android
Full support 4 |
Chrome Android
Full support 18 |
Firefox Android
Full support 50 |
Opera Android
No support No |
Safari iOS
Full support 5 |
Samsung Internet Android
Full support 1.0 |
webkitGetAsEntry
|
Chrome
Full support 13 |
Edge
Full support 14 |
Firefox
Full support 50 |
IE
No support No |
Opera
No support No |
Safari
Full support 11.1 |
WebView Android
No support No |
Chrome Android
Full support Yes |
Firefox Android
Full support 50 |
Opera Android
No support No |
Safari iOS
Full support 11.3 |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
DataTransferItem by Mozilla Contributors is licensed under CC-BY-SA 2.5.