Open Browser Window in Electron

April 4, 2020

If you want to open the browser window in your Electron application you can use the following code

If do not know how to create Electron app please refer this tutorial

in your index.js file, you can add the following code

var electron = require('electron')
var BrowserWindow = electron.BrowserWindow
var app = electron.app


app.on('ready', function () {
    console.log("Ready")
    appWindow = new BrowserWindow({
        show: false
    }); //appWindow

    appWindow.loadURL('file://' + __dirname + '/index.html');
    appWindow.once('ready-to-show', function () {
        appWindow.show();
    }); 
})