Skip to content

"new-win-policy" event does not fire for popup windows #1519

Closed
@semmel

Description

@semmel

The event does not fire for windows opened by gui.Window.open()
It just works for the main window and its child iframes.
Tested with Windows 7 32bit node-webkit v. 0.9.0rc1.
For a demo paste the code into the dev console of node-webkit:

var gui = require('nw.gui');
// for the main window it works fine:
var nwWindow = gui.Window.get();
nwWindow.window.document.body.innerHTML = '<a href="https://www.google.de" target="_blank">Go to Google</a>';
nwWindow.on('new-win-policy', console.log.bind(console, "main window"));
// clicking the link now logs to the console - Fine!

// for popups the event is not fired:
var nwPopup = gui.Window.open("http://www.example.com", {
    toolbar: false, nodejs:false, "new-instance": false});
nwPopup.window.document.body.innerHTML = '<a href="https://www.google.de" target="_blank">Go to Google</a>';
nwPopup.on('new-win-policy', console.log.bind(console, "popup window"));
// clicking the link does not fire the event :-(

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions