终于弄明白这问题了,只要在js文件里加上段代码,就可解决两窗口间通信问题。
 var str = {
username: User.name,
userrole: User.role
};
var new_win = gui.Window.get(
window.open('home.html', {focus: true})
);
new_win.on('loaded', function (User) {
new_win.window.window.str = str;
new_win.window.window.document.getElementById('msg').innerHTML="登录成功,用户名:" + str.username + ",用户角色:" +str.userrole;
});

1、在B页面中可以使用window.opener获得A页面的window句柄,使用该句柄即可调用A页面中的对象,函数等。例如A页面定义js函数onClosePageB,在B页面可以用window.opener.onClosePageB来进行回调。
2、使用 window.showModalDialog(sURL [, vArguments] [,sFeatures])打开新窗口。
其中vArguments 参数可以用来向对话框传递参数。传递的参数类型不限,包括数组、函数等。对话框通过window.dialogArguments来取得传递进来的参数。
3、如果是支持HTML5的话,建议用本地存储(local storage),它支持一个事件方法window.onstorage,只要其中一个窗口修改了本地存储,其他同源窗口会触发这个事件。

node-webkit 新建实例窗口间通信问题解决办法的更多相关文章

  1. HTML5 postMessage 和 localStorage 实现窗口间通信

    LocalStorage(不能跨域) 基本思想:通过localStorage的标准事件storage来实现跨页面通信,即页面A通过写入特定数据触发页面B的storage事件,页面B响应之后再写入数据通 ...

  2. electron窗口间通信

    以下代码均来自于我开发的开源软件:想学吗 窗口A的渲染进程发消息给主进程 const { clipboard, ipcRenderer, remote } = require('electron'); ...

  3. Node webkit启动最大化窗口

    <!DOCTYPE html> <html> <head>     </head> <body>     <p style=" ...

  4. 电脑装的是office2013,右键新建却是2007,或者右键新建菜单中没有excel2013问题解决办法。

    我的office出现了两个问题,因为工作比较忙,也没有着急解决,今天实在受不了了,花费一下午才找到解决方法. 原来万恶之源都是可恶的wps,以后千万不安装kingsoft了. 第一个问题:excel打 ...

  5. windows下nvm安装node之后npm命令找不到问题解决办法

    主要关键解解决办法:===>>适用于所有东西的安装 安装有关环境配置类的软件及其他,一般情况下切记不要安装到c盘programfiles下,否则会出现各种问题的报错!!!切记! nvm安装 ...

  6. python 全栈开发,Day91(Vue实例的生命周期,组件间通信之中央事件总线bus,Vue Router,vue-cli 工具)

    昨日内容回顾 0. 组件注意事项!!! data属性必须是一个函数! 1. 注册全局组件 Vue.component('组件名',{ template: `` }) var app = new Vue ...

  7. java线程间通信1--简单实例

    线程通信 一.线程间通信的条件 1.两个以上的线程访问同一块内存 2.线程同步,关键字 synchronized 二.线程间通信主要涉及的方法 wait(); ----> 用于阻塞进程 noti ...

  8. vue之父子组件间通信实例讲解(props、$ref、$emit)

       组件间如何通信,也就成为了vue中重点知识了.这篇文章将会通过props.$ref和 $emit 这几个知识点,来讲解如何实现父子组件间通信. 组件是 vue.js 最强大的功能之一,而组件实例 ...

  9. 系统间通信(9)——通信管理与RMI 下篇

    接上文<架构设计:系统间通信(8)--通信管理与RMI 上篇>.之前说过,JDK中的RMI框架在JDK1.1.JDK1.2.JDK1.5.JDK1.6+几个版本中做了较大的调整.以下我们讨 ...

随机推荐

  1. 项目管理利器——Maven

    假设公司要开发一个新的Web项目,使用目前流行的struts2.spring.MyBatis进行新项目开发.那么接下来首先要进行的工作就是各个框架的jar包的下载.大家通常的做法是先到struts2的 ...

  2. Can't add self as subview的困惑

    2016-05-27 09:40:43.4043 UMLOG: event: session_id=B63F36D84AD478B9F95C7D0F05DD819B, event=user_choos ...

  3. Baseline模板管理

    SQL> alter session set NLS_DATE_FORMAT= 'yyyy-mm-dd hh24:mi:ss'; 创建单一基线模板: SQL> exec dbms_work ...

  4. jquery对strutrs2 <s:radio>标签的设置和取值

    今天郁闷了1小时. 需求是这样的: <s:radio  list="#{0:'男',1:'女'}" value="member.sex" id=" ...

  5. G面经prepare: Sort String Based On Another

    Given a sorting order string, sort the input string based on the given sorting order string. Ex sort ...

  6. Leetcode: Majority Element II

    Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorit ...

  7. Lintcode: Minimum Adjustment Cost

    Given an integer array, adjust each integers so that the difference of every adjcent integers are no ...

  8. java 读取Excel文件并数据持久化方法Demo

    import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util ...

  9. 最新RubyMine2016.2开发Ruby ON Rails(ROR)程序的流程

    1.RubyMine新建ROR工程 File->New Project     选择Rails下的"New Application"     点击OK 后生成ROR项目   ...

  10. poj: 1207

    好吧这题竟然还有先大后小的可能,能不这么恶心下吗.. #include <iostream> #include <stdio.h> #include <string.h& ...