window.open
函数
当调用 window.open
以在网页中创建新窗口时,将为url
创建一个新的BrowserWindow 实例,并返回一个代理至 window.open
以让页面对其进行有限的控制。
The proxy has limited standard functionality implemented to be compatible with traditional web pages. For full control of the new window you should create a BrowserWindow
directly.
The newly created BrowserWindow
will inherit the parent window’s options by default. To override inherited options you can set them in the features
string.
frameName
String(可选)features
String(可选)
features
字符串遵循标准浏览器的格式,但每个 feature 必须是BrowserWindow
选项中的字段。 These are the features you can set via features
string: zoomFactor
, nodeIntegration
, preload
, javascript
, contextIsolation
, webviewTag
.
例如:
注意:
- 如果在父窗口中禁用了 Node integration, 则在打开的
window
中将始终被禁用。 - 父窗口禁用 Javascript,打开的
window
中将被始终禁用 features
中给定的非标准特性 (不由 Chromium 或 Electron 处理) 将被传递到 参数中的任何已注册webContent
的new-window
事件处理程序。
message
String
如果要使用 Chrome 的内置 window.open()
,请在 webPreferences
选项中将 nativeWindowOpen
设置为 true
。
原生 window.open ()
允许同步打开窗口, 因此可以方便的选择是对话框还是首选项窗口。
该选项也可以设置在<webview>
标签上: