# Native File Drag & Drop ## Overview Certain kinds of applications that manipulate files might want to support the operating system's native file drag & drop feature. Dragging files into web content is common and supported by many websites. Electron additionally supports dragging files and content out from web content into the operating system's world. To implement this feature in your app, you need to call the [`webContents.startDrag(item)`](../api/web-contents.md#contentsstartdragitem) API in response to the `ondragstart` event. ## Example An example demonstrating how you can create a file on the fly to be dragged out of the window. ### Preload.js In `preload.js` use the [`contextBridge`] to inject a method `window.electron.startDrag(...)` that will send an IPC message to the main process. ```js const { contextBridge, ipcRenderer } = require('electron') contextBridge.exposeInMainWorld('electron', { startDrag: (fileName) => { ipcRenderer.send('ondragstart', path.join(process.cwd(), fileName)) } }) ``` ### Index.html Add a draggable element to `index.html`, and reference your renderer script: ```html