window.opener is null

221 views
Skip to first unread message

lithi...@gmail.com

unread,
Sep 26, 2016, 9:15:01 AM9/26/16
to nw.js
I want to receive an object/message from the window that I open to the main window but window.opener is null in the newly opened window. How else do I do it? Using nwjs v0.17.4

nw.Window.open('https://github.com/', {
'inject_js_end': './script.js'
})

kailn...@gmail.com

unread,
Sep 27, 2016, 2:49:57 AM9/27/16
to nw.js, lithi...@gmail.com
var childWindow;

nw.Window.open('https://github.com/', { 'inject_js_end': './script.js' }, function (githubWindow) {
                githubWindow.on('loaded', function () {
                    childWindow = githubWindow.window;
                    childWindow.parentWindow = window;
                });
            });

now, in the main window you can access the child window, its variables and functions you can even call them.
In the child window you can access the parent window;
Reply all
Reply to author
Forward
Message has been deleted
0 new messages