Drag and drop
Lets people drag items within or into the page, and lets the page start drags.
In one line
Can let you drag items on the page, or drop files onto it
Lets people drag items within or into the page, and lets the page start drags.
A site can start a drag with text, links or files, and react when people drop things on it. Data in a drag is readable only on drop, so the page cannot spy on a drag it does not own.
What it can and can't do
What the user does: You drag a file, text or picture onto the page, or drag an item inside it.
It can
- Accept files you drop onto the page, such as photos or documents
- Let you rearrange items by dragging, like cards or lists
- Start a drag so you can pull text or an image out of the page
It cannot
- See your files before you drop them
- See files you did not drop
- Browse your folders on its own
- Take over dragging from other apps or windows
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 3 | 2009-09-15 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 3.5 | 2009-06-30 | None |
| Safari | Supported | 4 | 2009-06-08 | None |
| Safari on iPhone | Supported | 3.2 | 2010-04-03 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 18 | 2012-06-27 | None |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | dragstart, dragover, drop events; DataTransfer; draggable=true |
| Browser compat keys | api.DataTransferapi.HTMLElement.dragstart_eventapi.DataTransferItem.getAsFileSystemHandle |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | Per drag operation |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Dragging across iframes allowed; dropped data readable only in the drop handler |
Typical flow
- Person drags an item over the page
- dragover must call preventDefault to accept
- drop fires with dataTransfer
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- dataTransfer is in protected mode outside drop: types are visible, data is not readable until drop
- Cannot start an OS file drag from the page except the Chrome only DownloadURL type trick
- Dropped files expose name, size, type, lastModified; no full path
- Touch support: iOS Safari 11 (iPad and iPhone); Android Chrome supports long-press drag since Chrome 96 on some devices
- Drag image limited to a rendered element or image; size capped by the OS
The story
What it is
People can drag things around the page, or drop files onto it.
For you
You pick up a card, a file or a photo with your mouse or finger and drop it somewhere else. It feels natural, so you rarely think about it.
For makers
Makers use it to make web apps feel like real software: reordering lists, uploading by dropping a file, building layouts. It also boosts upload completion because dropping is easier than browsing folders.
Where you see it
| Type | Example | Apps |
|---|---|---|
| productivity | You drag a task card from To Do to Done in a project board. | Trello, Notion, Jira |
| creative | You drop a photo onto a design canvas and it appears where you let go. | Figma, Canva |
| games | You drag pieces on a browser puzzle or card game, like moving a card in solitaire. | None named |
| messaging | You drag a file into a chat window to send it. | Slack, Gmail |
| media | You drag songs into a playlist order on a web music player. | Spotify web player |
| shopping | You drag a product into a wish list or onto a compare bar. | None named |
Risks
- Accidental drops
- Dropped files read by the page
What the platform says
- Mozilla: HTML Drag and Drop API. MDN explains that pages can make items draggable and react when you drop files or text on them.
Good uses and abuse
Legitimate uses
- File upload zones
- Kanban boards
- Editors
Known abuse
- Drop-zone social engineering (fake upload prompts)
- Exfil of dropped sensitive files into the wrong site
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2017-09, Safari 11: Touch drag and drop on iOS 11 and iPadOS
- 2020-05, Chrome 86: DataTransferItem.getAsFileSystemHandle for dropped files
Related capabilities
Related
- Dropping files and folders onto the page. Can receive files or whole folders you drag onto the page
- File input (choose files to upload). Can open only the files you pick in the file chooser
Sources
How well checked: Based on official documentation.