browser-window.md (electron-11.2.3) | : | browser-window.md (electron-11.3.0) | ||
---|---|---|---|---|
# BrowserWindow | # BrowserWindow | |||
> Create and control browser windows. | > Create and control browser windows. | |||
Process: [Main](../glossary.md#main-process) | Process: [Main](../glossary.md#main-process) | |||
```javascript | ```javascript | |||
// In the main process. | // In the main process. | |||
const { BrowserWindow } = require('electron') | const { BrowserWindow } = require('electron') | |||
// Or use `remote` from the renderer process. | ||||
// const { BrowserWindow } = require('electron').remote | ||||
const win = new BrowserWindow({ width: 800, height: 600 }) | const win = new BrowserWindow({ width: 800, height: 600 }) | |||
// Load a remote URL | // Load a remote URL | |||
win.loadURL('https://github.com') | win.loadURL('https://github.com') | |||
// Or load a local HTML file | // Or load a local HTML file | |||
win.loadURL(`file://${__dirname}/app/index.html`) | win.loadURL(`file://${__dirname}/app/index.html`) | |||
``` | ``` | |||
## Frameless window | ## Frameless window | |||
skipping to change at line 736 | skipping to change at line 733 | |||
* `path` String | * `path` String | |||
Adds Chrome extension located at `path`, and returns extension's name. | Adds Chrome extension located at `path`, and returns extension's name. | |||
The method will also not return if the extension's manifest is missing or incomp lete. | The method will also not return if the extension's manifest is missing or incomp lete. | |||
**Note:** This API cannot be called before the `ready` event of the `app` module | **Note:** This API cannot be called before the `ready` event of the `app` module | |||
is emitted. | is emitted. | |||
**Note:** This method is deprecated. Instead, use | **Note:** This method is deprecated. Instead, use | |||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath). | [`ses.loadExtension(path)`](session.md#sesloadextensionpath-options). | |||
#### `BrowserWindow.removeExtension(name)` _Deprecated_ | #### `BrowserWindow.removeExtension(name)` _Deprecated_ | |||
* `name` String | * `name` String | |||
Remove a Chrome extension by name. | Remove a Chrome extension by name. | |||
**Note:** This API cannot be called before the `ready` event of the `app` module | **Note:** This API cannot be called before the `ready` event of the `app` module | |||
is emitted. | is emitted. | |||
skipping to change at line 778 | skipping to change at line 775 | |||
API is not for programming use. If you try to add an extension that has already | API is not for programming use. If you try to add an extension that has already | |||
been loaded, this method will not return and instead log a warning to the | been loaded, this method will not return and instead log a warning to the | |||
console. | console. | |||
The method will also not return if the extension's manifest is missing or incomp lete. | The method will also not return if the extension's manifest is missing or incomp lete. | |||
**Note:** This API cannot be called before the `ready` event of the `app` module | **Note:** This API cannot be called before the `ready` event of the `app` module | |||
is emitted. | is emitted. | |||
**Note:** This method is deprecated. Instead, use | **Note:** This method is deprecated. Instead, use | |||
[`ses.loadExtension(path)`](session.md#sesloadextensionpath). | [`ses.loadExtension(path)`](session.md#sesloadextensionpath-options). | |||
#### `BrowserWindow.removeDevToolsExtension(name)` _Deprecated_ | #### `BrowserWindow.removeDevToolsExtension(name)` _Deprecated_ | |||
* `name` String | * `name` String | |||
Remove a DevTools extension by name. | Remove a DevTools extension by name. | |||
**Note:** This API cannot be called before the `ready` event of the `app` module | **Note:** This API cannot be called before the `ready` event of the `app` module | |||
is emitted. | is emitted. | |||
skipping to change at line 1855 | skipping to change at line 1852 | |||
#### `win.addBrowserView(browserView)` _Experimental_ | #### `win.addBrowserView(browserView)` _Experimental_ | |||
* `browserView` [BrowserView](browser-view.md) | * `browserView` [BrowserView](browser-view.md) | |||
Replacement API for setBrowserView supporting work with multi browser views. | Replacement API for setBrowserView supporting work with multi browser views. | |||
#### `win.removeBrowserView(browserView)` _Experimental_ | #### `win.removeBrowserView(browserView)` _Experimental_ | |||
* `browserView` [BrowserView](browser-view.md) | * `browserView` [BrowserView](browser-view.md) | |||
#### `win.setTopBrowserView(browserView)` _Experimental_ | ||||
* `browserView` [BrowserView](browser-view.md) | ||||
Raises `browserView` above other `BrowserView`s attached to `win`. | ||||
Throws an error if `browserView` is not attached to `win`. | ||||
#### `win.getBrowserViews()` _Experimental_ | #### `win.getBrowserViews()` _Experimental_ | |||
Returns `BrowserView[]` - an array of all BrowserViews that have been attached | Returns `BrowserView[]` - an array of all BrowserViews that have been attached | |||
with `addBrowserView` or `setBrowserView`. | with `addBrowserView` or `setBrowserView`. | |||
**Note:** The BrowserView API is currently experimental and may change or be | **Note:** The BrowserView API is currently experimental and may change or be | |||
removed in future Electron releases. | removed in future Electron releases. | |||
[runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/bli nk/renderer/platform/runtime_enabled_features.json5?l=70 | [runtime-enabled-features]: https://cs.chromium.org/chromium/src/third_party/bli nk/renderer/platform/runtime_enabled_features.json5?l=70 | |||
[page-visibility-api]: https://developer.mozilla.org/en-US/docs/Web/API/Page_Vis ibility_API | [page-visibility-api]: https://developer.mozilla.org/en-US/docs/Web/API/Page_Vis ibility_API | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 9 lines changed or added |