loadUrl is not working in electron

Jay picture Jay · Jun 3, 2016 · Viewed 20.8k times · Source

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

Answer

Vadim Macagon picture Vadim Macagon · Jun 3, 2016

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