BrowserView Type
⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ✔
[!NOTE] The BrowserView class is deprecated, and replaced by the new WebContentsView class.A BrowserView can be used to embed additional web content into a BrowserWindow. It is like a child window, except that it is positioned relative to its owning window. It is meant to be an alternative to the webview tag.### Class: BrowserView> Create and control views.> [!NOTE] The BrowserView class is deprecated, and replaced by the new WebContentsView class.Process: MainThis module cannot be used until the ready event of the app module is emitted.> [!WARNING] Electron's built-in classes cannot be subclassed in user code. For more information, see the FAQ.### Example// In the main process.const { app, BrowserView, BrowserWindow } = require('electron')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')})
Constructors
| Constructor |
Description
|
Full Usage:
BrowserView(?webPreferences)
Parameters:
WebPreferences
-
Settings of web page's features.
Returns: BrowserView
|
|
fable-electron-docs-api