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

Skip to content

Commit 5e5c4e1

Browse files
authored
Merge pull request #200 from JulianGlueck/feat-preventNewWindows
Add documentation for `suppressNewWindows` method
2 parents c009b30 + 240f5e0 commit 5e5c4e1

File tree

1 file changed

+13
-0
lines changed
  • resources/views/docs/desktop/1/the-basics

1 file changed

+13
-0
lines changed

resources/views/docs/desktop/1/the-basics/windows.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,19 @@ Window::open()
394394

395395
This is particularly useful for always-on-top utility windows or menubar applications that should not be visible in Mission Control.
396396

397+
#### Preventing new windows from popping up
398+
399+
By default, Electron allows additional windows to be opened from a window that was previously opened programmatically.
400+
This is the case, for example, with `a` elements that have the target attribute set to `_blank` or when the user clicks on a link with the middle mouse button.
401+
This behaviour is potentially undesirable in a desktop application, as it enables the user to "break out" of a window.
402+
403+
To prevent additional windows from opening, you can apply the `suppressNewWindows()` method when opening a new window.
404+
405+
```php
406+
Window::open()
407+
->suppressNewWindows();
408+
```
409+
397410
### Zoom factor
398411

399412
In certain cases, you may want to set a zoom factor for a window.

0 commit comments

Comments
 (0)