title: Electron: Drag tab into another open window
body: <p>I am creating a electron application that looks similar to google chrome with multiple dynamic tabs for different pages. The application also supports multiple open windows. I want to be able to drag tabs between these windows. I already know how to send messages between my windows with the ipcRenderer but I am coming up against a few roadblocks:</p>
  
  <p>1) I cannot drag an html element outside of a window. How can I drag the tab (or something that looks identical) outside of the window?</p>
  
  <p>I've found a <a href="https://discuss.atom.io/t/drag-and-drop-dom-elements-between-between-multiple-electron-windows-possible/24004" rel="noreferrer">discussion</a> on the atom forums where someone claimed they were able to achieve this, but do not elaborate on how. They claim "Native HTML5 Drag and Drop in combination with IPC messaging was the solution". Someone else links a GitHub example below, but the example has since been removed.</p>
  
  <p>2) How do I detect when a tab is dragged onto another open window (Mouse released on other window)?</p>
  
  <p>Again the discussion suggests I use IPC messaging to do this, but I have not found a way to get the id of the window you release the mouse on.</p>
  
  <p>Edit:</p>
  
  <p>I have found a solution to issue 1. The mentioned discussion was right and using <a href="https://www.html5rocks.com/en/tutorials/dnd/basics/" rel="noreferrer">default HTML5 dragging behavior</a> was able to create the effect I wanted. Issue 2 still stumps me. I understand the concept of alerting all other open windows with an IPC message to prepare for an incoming drag but I am still unsure how to get the id of the window and the position you dragged to on it so you can send the tab information to the correct place.</p>