Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loadUrl is not working in electron

Tags:

i am new to electron.

i tried to run the index.js with following lines, it worked

const electron = require("electron") const app = electron.app const BrowserWindow = electron.BrowserWindow var mainWindow = null  app.on('ready', function () {   mainWindow = new BrowserWindow({width: 800, height: 600}) }) 

but when i tried to add this line,

mainWindow.loadUrl('file://${ __dirname}/index.html') 

it return an error "typeError:mainWindow.loadUrl is not a function"

i searched a lot for the answer, but didnt get any answer for this.

can any suggest a solution for this? any help will be appreciated

like image 981
Jay Avatar asked Jun 03 '16 12:06

Jay


People also ask

How do I make the electron app full screen?

To make an Electron app run in full-screen mode when it's started, pass the following configuration option when creating the BrowserWindow instance: mainWindow = new BrowserWindow({fullscreen: true});

How do you create an electron window for a child?

As known was built with a window BrowserWindow module in electron. To create a child window we only need to define the parent window while we create the required window. Let's define the parent window first, then let's define the child window.


1 Answers

loadUrl() was renamed to loadURL() a while back.

like image 63
Vadim Macagon Avatar answered Sep 22 '22 21:09

Vadim Macagon