Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Electron window.open function


May 25, 2021 Electron


Table of contents


When you use window.open interface to create a new window, BrowserWindow is created and an identity is returned, which gives the new window limited control through the identity.

This identity for the traditional web interface, through which it can be limited functional compatibility control of sub-windows. For full control of this window, you can create a BrowserWindow .

The newly created BrowserWindow to inheriting the property parameters of the parent window, and you can set them in features override the properties.

window.open(url[, frameName][, features])

  • url String
  • frameName String (optional)
  • features String (optional)

Create a new window and return an instance BrowserWindowProxy class.

features follow the format of a standard browser, but each feedure should be a field for the BrowserWindow parameter.

window.opener.postMessage(message, targetOrigin)

  • message String
  • targetOrigin String

Send information to the parent * a location or replacing it with a s instead of an explicit location.

Class: BrowserWindowProxy

BrowserWindowProxy window.open and provides limited functional control over subwindows.

BrowserWindowProxy.blur()

The loss of focus of the child window.

BrowserWindowProxy.close()

Force the closure of the sub window and ignore the uninstall event.

BrowserWindowProxy.closed

Return to normal after the child window is closed.

BrowserWindowProxy.eval(code)

  • code String

Evaluate the code for the sub-window.

BrowserWindowProxy.focus()

Sub-windows get focus (let it appear at the front).

BrowserWindowProxy.postMessage(message, targetOrigin)

  • message String
  • targetOrigin String

Send information to sub-windows * a location or replacing an unsequivo one with a .

In addition to these methods, sub-windows can also implement window.opener objects without attributes and using a single method.