Lesson 25 of 28
javascriptCreating BrowserWindows – Options & Features
9 mins
Course progress89%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 25 of 28
javascript9 mins
Keep these ideas in mind as you work through the lesson.
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());