Lesson 25 of 28 · javascript
Creating BrowserWindows – Options & Features
Duration: 9 mins
Creating BrowserWindows – Options & Features
BrowserWindow accepts an options object that controls size, frame, transparency, security, etc.
const win = new BrowserWindow({
width: 1024,
height: 768,
title: "My Electron App",
show: false, // create hidden, show later for smooth startup
webPreferences: {
preload: path.join(__dirname, '../preload/bridge.js'),
contextIsolation: true, // must be true for security
nodeIntegration: false,
enableRemoteModule: false
}
});
Common useful flags:
transparent: true– frameless windows.alwaysOnTop: true– stay above other apps.resizable: false– fixed‑size UI.
Show the window after it’s ready:
win.once('ready‑to‑show', () => win.show());