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

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 26 of 28 · javascript

Loading Local HTML, Remote URLs & Custom Protocols

Duration: 8 mins

Loading Local HTML, Remote URLs & Custom Protocols

Local file – most common:

win.loadFile('src/index.html');

Remote URL – be careful with security (CSP, webSecurity):

win.loadURL('https://app.example.com');

Custom protocol – useful for bundlers (e.g., app://):

app.whenReady().then(() => {
  protocol.registerFileProtocol('app', (request, callback) => {
    const url = request.url.substr(6); // strip "app://"
    callback({ path: path.normalize(`${__dirname}/${url}`) });
  });
  win.loadURL('app://index.html');
});

When loading remote content, disable Node integration and enforce Content‑Security‑Policy headers.

Previous: Creating BrowserWindows – Options & FeaturesNext: Menus, Application Menu & Tray Icons