Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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)

Copy link
Member

@simonhamp simonhamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to align this with Electron's naming and defaults for now. We can change it later if we want

@gwleuverink gwleuverink merged commit 1c120f9 into NativePHP:main Sep 2, 2025
18 of 20 checks passed
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.

3 participants