Marco Pracucci

Electron - Open DevTools in a popup

by Marco Pracucci Comments

When you open a new window with window.open() in Electron, DevTools are closed by default and there’s no key binding to open it. However, you can run the following code in the main window to get the reference to the popup’s BrowserWindow and openDevTools().

var remote = require("remote");
var BrowserWindow = remote.require("browser-window");
var windows = BrowserWindow.getAllWindows();

// Look for the popup window and then...
windows[1].openDevTools();

<img src=”/assets/2015-07-02-electron-popup-devtools-ee6f438ff9b89e8a215d6247ee82b59cbe9237c7c49230be3daef07f47cabb0a.gif” width=681 height=583 width=”682” height=”563” alt=”2015-07-02-electron-popup-devtools.gif”>

Related articles

RSS Feed

To get a notification each time a new article gets published, type the following command on your Slack: /feed subscribe https://pracucci.com/feed.xml

Comments