Skip to content
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 with policy.xx anything other than ignore() fails #7209

Closed
ka1izer opened this issue Nov 12, 2019 · 3 comments
Closed

new-win-policy with policy.xx anything other than ignore() fails #7209

ka1izer opened this issue Nov 12, 2019 · 3 comments
Assignees

Comments

@ka1izer
Copy link

ka1izer commented Nov 12, 2019

NWJS Version : 0.41.2 - 0.42.3 (x64)
Operating System : Windows 10 64bits

Expected behavior

policy.forceCurrent() should prevent ctrl+click on link from opening a new window.

Actual behavior

It still opens a new window. .forceDownload() is also ignored, as well as setNewWindowManifest({fullscreen: true}) (only tested fullscreen=true, which did not work, don't know if other options would work).
.ignore() does work, though.

How to reproduce

main:

<html>
	<head>
		<script type="text/javascript" src="test.js"></script>
</head>
<body>
	<a href="test.html">Ctrl+click here</a>
</body>

</html>

test.js:

window.nw.Window.get().on('new-win-policy', (frame, url, policy) => {
	console.log('fired');
	policy.forceCurrent();
});

ctrl+click on the link ("Ctrl+click here"), see "fired" in the log, but it opens in a new window.

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@cdog
Copy link

cdog commented Feb 3, 2022

Still reproducing. Bumped into same issue with:

policy.setNewWindowManifest({
  show: false,
});

The new window is still visible. Only policy.ignore() works. Tested with NW.js v0.60.1.

@cdog
Copy link

cdog commented Apr 4, 2022

Any updates on this? Since policy.setNewWindowManifest doesn't work (before window is created), hiding the window later via chrome.windows.onCreated as a temporary fix (after window is created) resulting in annoying flickering effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants