Skip to content

Allow optional suppression of opening sub-windows #685

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JulianGlueck
Copy link
Contributor

@JulianGlueck JulianGlueck commented Aug 22, 2025

This PR allows developers to disable the opening of potentially unwanted pop-up windows.

By default, Electron doesn't prevent sub-windows to be opened out of a window. This would for instance be the case if a user middle-clicks a link. This behaviour is potentially undesirable in a desktop application, as it enables the user to "break out" of a window.

To prevent additional windows from opening, this PR adds a suppressNewWindows() method that can be applied when opening a new window. It will prevent any pop-up windows being opened.

Electron PR: NativePHP/electron#249
Docs PR: NativePHP/nativephp.com#200

If there's anything you'd like me to tweak or improve in this PR, please let me know. 😊

@gwleuverink
Copy link
Contributor

Ha nice. This was a pet-peeve I've forgotten about. Thanks!

@NativePHP/contributors Some things to consider:

  1. How about making this the default behavior? I think opening new windows from a url is not preferable in most cases. We can keep the option to allow it in. (This will be a breaking change, albeit a minor one)
  2. I think the naming is good, but wondering if preventNewWindows instead of suppressNewWindows makes sense (or allowNewWindows if we vote to make preventing the default)

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

Successfully merging this pull request may close these issues.

2 participants