diff --git a/docs/tutorial/first-app.md b/docs/tutorial/first-app.md index 33ebac906d..0721b207b2 100644 --- a/docs/tutorial/first-app.md +++ b/docs/tutorial/first-app.md @@ -106,19 +106,13 @@ for the application to be ready and open a window: ```javascript const {app, BrowserWindow} = require('electron') -const path = require('path') -const url = require('url') function createWindow () { // Create the browser window. win = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. - win.loadURL(url.format({ - pathname: path.join(__dirname, 'index.html'), - protocol: 'file:', - slashes: true - })) + win.loadFile('index.html') } app.on('ready', createWindow) @@ -131,8 +125,6 @@ windows on macOS if the user clicks on the app's icon in the dock. ```javascript const {app, BrowserWindow} = require('electron') -const path = require('path') -const url = require('url') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -143,11 +135,7 @@ function createWindow () { win = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. - win.loadURL(url.format({ - pathname: path.join(__dirname, 'index.html'), - protocol: 'file:', - slashes: true - })) + win.loadFile('index.html') // Open the DevTools. win.webContents.openDevTools()