custom-electron-browser Tailwind Templates

Custom Electron Browser

Lightweight, multi-tab Electron browser built with Tailwind CSS, featuring local session persistence and enhanced webview security.

Custom Electron Browser

Lightweight, multi-tab Electron browser built with Tailwind CSS, featuring local session persistence and enhanced webview security.

Features

  • šŸ—‚ļø Multi-tab browsing with webviews
  • šŸ’¾ Persistent tab storage between sessions
  • šŸŽØ Tailwind CSS-styled UI
  • šŸ”’ Enhanced security configurations
  • āŒØļø Ctrl+Shift+H toggle for UI bars
  • šŸ›”ļø Content Security Policy (CSP) headers
  • 🚫 Example.com domain blocking
  • šŸ“¶ Network request interception
  • šŸ”„ Live reload during development

Installation

Clone the repository:

git clone https://github.com/Endrulis/custom-electron-browser.git
cd custom-electron-browser

Install dependencies:

npm install

Usage

Start the application:

npm start

Basic Controls

  • New Tab: Click the '+' button.
  • Close Tab: Click the 'Ɨ' on a tab.
  • Navigate: Enter a URL and press Enter.
  • Toggle UI: Press Ctrl+Shift+H.
  • Fullscreen: Use the standard OS toggle.

File Structure

custom-browser/
ā”œā”€ā”€ index.js         # Main process configuration
ā”œā”€ā”€ index.html      # Browser window UI
ā”œā”€ā”€ preload.js      # IPC communication bridge
ā”œā”€ā”€ styles/
│   └── tailwind.min.css  # Tailwind CSS styles
└── browser-data/   # Persistent user data

Security Features

Context Isolation and Sandboxing

// In index.js, when creating the BrowserWindow:
webPreferences: {
  contextIsolation: true,
  sandbox: true,
  preload: path.join(__dirname, "preload.js")
}

Content Security Policy (CSP) Headers

// In main process, set the CSP headers:
"Content-Security-Policy": [
  "default-src 'self' 'unsafe-inline' data: blob: filesystem: http: https: ws: wss;"
]

Webview Hardening

// Harden webviews in main process:
mainWindow.webContents.on("will-attach-webview", (event, webPreferences) => {
  webPreferences.nodeIntegration = false;
  webPreferences.contextIsolation = true;
});

Development

Live reload is enabled via electron-reload.

Ignored Paths

  • browser-data/
  • node_modules/

Example: electron-reload Configuration

require("electron-reload")(__dirname, {
  electron: require(`${__dirname}/node_modules/electron`),
  ignored: /browser-data|node_modules|[/\\]./
});

Top categories

Loading Svelte Themes