References Getting Started Getting Started Architecture Architecture Application Application Window Window WebView WebView Deployment Deployment Components Components Framework Integrations Framework Integrations Examples Examples Community Community github GitHub github Get Started arrow_up_right
Getting Started Getting Started Architecture Architecture Application Application Window Window WebView WebView Deployment Deployment Components Components Framework Integrations Framework Integrations Examples Examples Community Community

WebView

WebView Configuration Events Schemes API Bindings API Data API Scripts API Web Components API Battery API Network API Security API Getting Started Architecture Application Window WebView Deployment Components Framework Integrations Examples Community

Configuration

The webview configuration class Boson\WebView\WebViewCreateInfo is optional and serves as a convenient way to define default settings for webview of main window instance.

Default User Agent

Sets a custom user agent string for the WebView.

$webviewConfig = new Boson\WebView\WebViewCreateInfo( 
    userAgent: 'MyCustomUserAgent/1.0',
);

Storage (Persistent Client Settings)

Configures persistent storage settings for the WebView.

If storage is enabled, persistent settings will be saved between different app executions, such as saved passwords, history, and other data shared across browsers.

$webviewConfig = new Boson\WebView\WebViewCreateInfo( 
    storage: '/path/to/storage', // Defaults to false (disabled)
);

The storage value can take on different types:

  • false - The storage will be disabled.
  • null - The storage will be enabled and directory will be determined automatically based on the current working directory.
  • string - The storage will be enabled and directory will be based on the passed argument.

Extra Flags

Sets additional WebView configuration flags.

$webviewConfig = new Boson\WebView\WebViewCreateInfo( 
    flags: [
        'enable-javascript' => false,
    ],
);

These are additional platform-dependent launch flags and their behavior may differ on different platforms.

Windows/WebView2

For WebView2 list of all available flags can be found on MSDN and chromium.org

$webviewConfig = new Boson\WebView\WebViewCreateInfo(flags: [
    '--disable-features' => ['feature1', 'feature2'],
    '--do-something',
]);

Linux/GTK4

For WebkitGTK list of all available flags can be found at webkitgtk.org

$webviewConfig = new Boson\WebView\WebViewCreateInfo(flags: [
    'enable-javascript' => false,
]);

macOS/WebKit

For WKWebView list of all available flags can be found at developer.apple.com

$webviewConfig = new Boson\WebView\WebViewCreateInfo(flags: [
     'upgradeKnownHostsToHTTPS' => true,
     'defaultWebpagePreferences.allowsContentJavaScript' => false,
     'preferences.minimumFontSize' => 10,
     'applicationNameForUserAgent' => 'Boson',
]);

Context Menu

Controls whether the default context menu (right mouse button) is enabled.

$webviewConfig = new Boson\WebView\WebViewCreateInfo( 
    contextMenu: true, // Default is false
);

Dev Tools

Enables or disables developer tools for the WebView.

$webviewConfig = new Boson\WebView\WebViewCreateInfo( 
    devTools: true, // Default is null
);

The developer tools settings can take one of the following values:

  • true - Enables developer tools window.
  • false - Disables developer tools window.
  • null - Depends on the application debug settings. Developer tools will be enabled if debug is enabled and vice versa.
github discord telegram Get started Documentation Contribution Guide License Release Notes BOSON PHP © 2025. All Rights Reversed.