New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new-win-policy prevent default #2926
Comments
I've tried that code and it works for me - it opens the URL in my default browser (Chrome) and nothing changes in the node-webkit window. What happens for you? (I'm on OSX 10.10.1 and node-webkit 0.11.5) |
Every time I click on an URL it gets opened on both the default browser and a new node-webkit window. |
Here the DMG of my app: |
Any update? |
Try
|
with it two node-webkit windows get opened |
It works for me on Mac, which platform are you using / have you tested on? |
Yosemite |
I have the same problem on windows 7, NW 0.11.6. It happens just on gmail.com with elements targer="_blank" (links in linkedin.com email's is best to reproduce)
This is mi new-win-policy
But the window is still created. |
The problem is in simulating javascript click on element with target _blank.
Event new-win-policy did not call, but the window is still created.
|
I confirm that having an element like
the var eventsNewWinPolicy = function(frame, url, policy) {
console.log("navigate to "+url);
policy.ignore();
gui.Shell.openExternal( url );
}; will only work once, then the policy ignore will not work, and a new window will be opened. |
Same problem in 17.1: it work only once and then not working at all. |
@VoidVolker the following always works for me with 0.17.1: <html>
<head>
<title></title>
<script>
var win = nw.Window.get();
win.on('new-win-policy', function(frame, url, policy) {
console.log("new-win-policy called: " + url);
policy.ignore();
});
</script>
</head>
<body>
<a href="target.html" target="_blank">new window</a>
</body>
</html> |
Yes, for me too. But place |
Are you suggesting it stops working in the new window? That works for me too. Please upload a full sample. Here is mine: index.html <html>
<head>
<title></title>
<script>
var win = nw.Window.get();
win.on('new-win-policy', function(frame, url, policy) {
console.log("new-win-policy called in main win: " + url);
//policy.ignore();
});
</script>
</head>
<body>
<a href="target.html" target="_blank">new window</a>
</body>
</html> target.html <!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title></title>
<script>
var win = nw.Window.get();
win.on('new-win-policy', function(frame, url, policy) {
console.log("new-win-policy called: " + url);
policy.ignore();
});
</script>
</head>
<body>
<p>t1</p>
<a href="t2.html" target="_blank">new window 2</a>
</body>
</html> |
close until more information is provided. |
really? LOL better use Electron at this point if this is the professionality here 😓 |
I'm trying to access Google Inbox using a node-webkit app and I/m trying to make my app open every link on the default browser listening for
new-win-policy
, the problem is that when I click on a link it gets opened on the default browser but it gets even opened on a new node-webkit window.Is there a way to call some kind of
preventDefault()
on this event?This is the very simple app:
Thanks!
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: