nwjs有没有API用来打开新的nw实例窗口
现在有一个nw窗口a,需要使用API打开另外一个nw窗口b,且窗口b内可以调用nodejs及对窗口的操作的API。
package.json
{
"name": "node-webkit menu demo",
"main": "index.html",
"version": 1.1,
"window": {
"show": false,
"position": "center",
"single-instance": false,
"width": 500,
"toolbar":true,
"frame":true,
"node-remote":"<local>",
"height": 500
}
}
打开子窗口
function openChildWindow() {
var url = "http://localhost:3900/file/1";
var docWindowOptions = {
"new-instance": true,
"show_in_taskbar":true,
//"toolbar":false,
"show": true
};
require('nw.gui').Window.open(url,docWindowOptions)
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
参考文档: https://github.com/nwjs/nw.js/wiki/Window#openurl-options
open(url[, options])
Open a new window and load url in it, you can specify extra options with the window. All window subfields in Manifest format can be used. Since v0.4.0, a boolean field new-instance can be used to start a new Node instance (webkit process). Since v0.9.0 and 0.8.5, inject-js-start and inject-js-end field can be used to inject a javascript file, see Manifest format .
Since v0.7.3 the opened window is not focused by default. It's a result of unifying behavior across platforms. If you want it to be focused by default, you can set focus to true in options.