Native File Drag & Drop

    To implement this feature in your app, you need to call the 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.

    Add a draggable element to index.html, and reference your renderer script:

    In set up the renderer process to handle drag events by calling the method you added via the contextBridge above.

    After launching the Electron application, try dragging and dropping the item from the BrowserWindow onto your desktop. In this guide, the item is a Markdown file located in the root of the project: