Open armoret opened 9 years ago
You marked this as a regression, it would be useful to know which previous version it worked correctly in
Hum, you're right : I did not noticed this case before but it doesn't mean it was running correctly in previous releases because I did not check the pop-up windows opening in all the sites I've tested. I've changed the title of this post and will try to test again with the older releases I kept.
Hello to all, I confirm it's really a regression. I have tested the same code (see extract below) with an older version (0.9.2 win32) on the same web site and it was working well (in other words, the function was well called when opening a popup window clicking on one link).
I hope you will be able to fix it !
Thanks.
// ------------------------
// Listen to the open event
// ------------------------
win.on('new-win-policy', function(frame, url, policy) {
console.log('new-win-policy event on ' + frame);
// To ignore:
policy.ignore();
// Open new child window, url is passed in a global variable
console.log('Opening url in new window:' + url);
global.url = url;
var new_win = gui.Window.open('browser.html', {
"show": true,
"toolbar": false,
"icon": "icon.png",
"frame": true,
"focus": true,
"position": "center",
"width": 1024,
"height": 768,
"min_width": 640,
"min_height": 480
});
});
See #1519 new-win-policy
event does not fire for not-node (normal) popup windows - this is not fixed in nwjs 0.16.0
. (For node frames everything is fine.)
The event is not published on nw popup windows for target = '_blank'
links.
Simple to reproduce from the developer tools:
nw.Window.open("http://www.example.com", {id : "example.com"},
(nwPopup) => nwPopup.on('loaded', () => {
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"));
})
);
03.08.2016 Updated the comment, that the bug concerns just non-node frames.
I believe that this is happening when loading a chrome app. The chrome packaged apps do not seem to have a node context. Any idea on a fix or suggested work around?
You can give it Node context by adding "node" permission to manifest.json
On Nov 15, 2017 7:21 AM, "Ben Sparks" notifications@github.com wrote:
I believe that this is happening when loading a chrome app. The chrome packaged apps do not seem to have a node context. Any idea on a fix or suggested work around?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nwjs/nw.js/issues/2820#issuecomment-344433311, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKGGdgK43Br3Qnlac-8ELMYVV1Pw9GNks5s2iBdgaJpZM4DJipv .
hmm, well I add "node" to permissions array in the manifest.json and then the app will no longer load. the exe gets added to the task manager (windows) but it no longer opens the packaged app window. there are no errors or any info as to why.
Hi Roger, I'm using the iframe object for embedding a web site. It's working pretty very well (thank you) but depending on how a popup is openin this web site, I can or can't get (and catch) the new-win-policy event (This has been tested with version 0.11.3. Windows 32 bits).
What is working:
What is not working:
For instance, the code below works well if you open it from a local file but doesn't it you use the web site it has been picked of. I don't really understand why because if you consider the html tag anf the javascript code, the popup is open with a standard window.open call.
To reproduce the issue:
This is the hosted nw iframe I'm using (see url inside):
Obviously, I'm catching the new-win-policy on the window containing this frame.
I've put the screenshot with the image link you have to click on to open a new window.
And here is the extract of the link on the remote page and the associated javascript code :
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.