Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions resources/views/docs/desktop/1/the-basics/menu-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,21 @@ MenuBar::create()

To learn more about the `Menu` facade, please refer to the [Application Menu](/docs/the-basics/application-menu) documentation.

### Setting webpage features

You may control various web page features by passing an optional `webPreferences` configuration array, similar to how it works with [Windows](/docs/the-basics/windows#setting-webpage-features). This allows you to customize how the menu bar window behaves and what features are available to the web content.

```php
MenuBar::create()
->webPreferences([
'nodeIntegration' => true,
'spellcheck' => true,
'backgroundThrottling' => true,
]);
```

The same defaults and restrictions apply as with Windows. For more details about available options and default settings, see the [Windows documentation](/docs/the-basics/windows#setting-webpage-features).

## Events

NativePHP provides a simple way to listen for menu bar events.
Expand Down
30 changes: 30 additions & 0 deletions resources/views/docs/desktop/1/the-basics/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,36 @@ In order to keep the window draggable, you should add an HTML element with the f
</div>
```

### Setting webpage features

You may control various web page features by passing an optional `webPreferences` configuration array. This allows you to customize how the Electron window behaves and what features are available to the web content.

```php
Window::open()
->webPreferences([
'nodeIntegration' => true,
'spellcheck' => true,
'backgroundThrottling' => true,
]);
```

#### Default Settings

NativePHP sets the following defaults for security and compatibility:

```php
[
'sandbox' => false, // locked
'preload' => '{preload-path}', // locked
'contextIsolation' => true, // locked
'spellcheck' => false,
'nodeIntegration' => false,
'backgroundThrottling' => false,
]
```

The `preload`, `contextIsolation`, and `sandbox` options are locked and cannot be changed for security reasons. All other options from the [Electron WebPreferences documentation](https://www.electronjs.org/docs/latest/api/structures/web-preferences) may be passed and will override the defaults.

## Events

NativePHP provides a simple way to listen for native window events.
Expand Down