wx.html2.WebViewConfiguration¶
This class allows access to web view configuration options and settings, that have to be specified before placing a webview in a window with wx.html2.WebView.Create .
Added in version 4.3/wxWidgets-3.3.0.
See also
wx.html2.WebView.NewConfiguration
Class Hierarchy¶
Methods Summary¶
Allows to disable persistent storage for the webview. |
|
Returns the backend identifier for which this configuration was created. |
|
Returns the data path for the webview. |
|
Returns the pointer to the native configuration used during creation of a wx.html2.WebView. |
|
Set the data path for the webview. |
Properties Summary¶
See |
|
See |
|
Class API¶
- class wx.html2.WebViewConfiguration(object)¶
This class allows access to web view configuration options and settings, that have to be specified before placing a webview in a window with WebView.Create().
Methods¶
- EnablePersistentStorage(self, enable)¶
Allows to disable persistent storage for the webview.
The default is to enable it. When the webview is created without persistent storage the data is stored in memory and is lost when the webview is destroyed. In browsers this is equivalent to “private browsing” or “incognito mode”.
- Parameters:
enable (bool)
- Return type:
bool
- Returns:
Trueif the backend supports to modify this setting.Falseif the setting is not supported by the backend.
Added in version 4.3/wxWidgets-3.3.0.
Note
This is only implemented on the Edge, WebKit2GTK+ and macOS backends.
- GetBackend(self)¶
Returns the backend identifier for which this configuration was created.
- Return type:
str
- GetDataPath(self)¶
Returns the data path for the webview.
This is the path where the webview stores its data, such as cookies, local storage, etc.
- Return type:
str
- Returns:
The path to the data directory.
Note
This is used by Edge, WebKit2GTK+ and Chromium backends and always returns empty string for the other ones.
- GetNativeConfiguration(self)¶
Returns the pointer to the native configuration used during creation of a wx.html2.WebView.
When using two-step creation this method can be used to customize configuration options not available via GetNativeBackend() after using Create().
Additional instances of wx.html2.WebView must be created using the same wx.html2.WebViewConfiguration instance.
All settings must be set before creating a new web view with
wx.html2.WebView.New.The return value needs to be down-casted to the appropriate type depending on the backend:
macOS: WKWebViewConfiguration pointer,
Windows with Edge: ICoreWebView2EnvironmentOptions.
WebKitGTK: WebKitWebContext pointer.
With other backends/platforms it’s not implemented.
The following pseudo code shows how to use this method with two-step creation to set no user action requirement to play video in a web view:
- Return type:
Any
- SetDataPath(self, path)¶
Set the data path for the webview.
This is the path where the webview stores its data, such as cookies, local storage, etc.
- Parameters:
path (string) – The path to the data directory.
- Return type:
None
Note
This is used by Edge, WebKit2GTK+ and Chromium backends (the latter creates “UserData” subdirectory under the given path).
Properties¶
- Backend¶
See
GetBackend
- DataPath¶
See
GetDataPathandSetDataPath
- NativeConfiguration¶