From e9a2792b5580524d5192ee218bb7d8cb3fc023cd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 31 Oct 2016 11:34:53 -0700 Subject: [PATCH] Format URL passed to BrowserWindow.loadURL --- docs/tutorial/quick-start.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index 682016e45b08..d95957a48c9f 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -81,6 +81,8 @@ example being: ```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. @@ -91,7 +93,11 @@ function createWindow () { win = new BrowserWindow({width: 800, height: 600}) // and load the index.html of the app. - win.loadURL(`file://${__dirname}/index.html`) + win.loadURL(url.format({ + pathname: path.join(__dirname, 'index.html'), + protocol: 'file:', + slashes: true + })) // Open the DevTools. win.webContents.openDevTools() @@ -225,8 +231,10 @@ repository. $ git clone https://github.com/electron/electron-quick-start # Go into the repository $ cd electron-quick-start -# Install dependencies and run the app -$ npm install && npm start +# Install dependencies +$ npm install +# Run the app +$ npm start ``` For more example apps, see the