Skip to content
Snippets Groups Projects
Unverified Commit c1c710bc authored by MikeBusuttil's avatar MikeBusuttil Committed by GitHub
Browse files

docs: improve BrowserView example (#32098)


* working example

previous example not beginner-friendly

* Update browser-view.md

Co-authored-by: default avatarCheng Zhao <github@zcbenz.com>
parent 30e0620c
No related merge requests found
......@@ -15,14 +15,16 @@ Process: [Main](../glossary.md#main-process)
```javascript
// In the main process.
const { BrowserView, BrowserWindow } = require('electron')
const { app, BrowserView, BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600 })
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600 })
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
})
```
### `new BrowserView([options])` _Experimental_
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment