Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Creating BrowserWind | Electron.js Desktop App Development l | BraveProgrammer
  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 25 of 28

·javascript

Creating BrowserWindows – Options & Features

9 mins

Course progress89%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • `webPreferences` are the security gate‑keeper – always enable `contextIsolation` and disable `nodeIntegration`.
  • Create the window **hidden** (`show:false`) then reveal it on `ready-to-show` for a smooth experience.
  • Use `preload` to point at a bridge script that will be loaded before any renderer code.

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());
Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Electron.js Desktop App DevelopmentBrowse activities
Previous lessonProject Structure & npm ScriptsContinue to lesson 26Loading Local HTML, Remote URLs & Custom ProtocolsBack to Electron.js Desktop App Development curriculum