diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 850cd7096624..e1b0784b9739 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -950,9 +950,23 @@ Same as `webContents.capturePage([rect, ]callback)`. Same as `webContents.loadURL(url[, options])`. -The `url` can be a remote address (e.g. `http://`) or a path to a local +The `url` can be a remote address (e.g. `http://`) or a path to a local HTML file using the `file://` protocol. +To ensure that file URLs are properly formatted, it is recommended to use +Node's [`url.format`](https://nodejs.org/api/url.html#url_url_format_urlobject) +method: + +```javascript +let url = require('url').format({ + protocol: 'file', + slashes: true, + pathname: path.join(__dirname, 'index.html') +}) + +win.loadURL(url) +``` + #### `win.reload()` Same as `webContents.reload`.