.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.html2.WebViewConfiguration:
==========================================================================================================================================
|phoenix_title| **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 :meth:`wx.html2.WebView.Create` .
:ref:`wx.html2.WebView`
.. versionadded:: 4.3/wxWidgets-3.3.0
.. seealso:: :meth:`wx.html2.WebView.NewConfiguration`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
WebViewConfiguration:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.html2.WebViewConfiguration.EnablePersistentStorage` Allows to disable persistent storage for the webview.
:meth:`~wx.html2.WebViewConfiguration.GetBackend` Returns the backend identifier for which this configuration was created.
:meth:`~wx.html2.WebViewConfiguration.GetDataPath` Returns the data path for the webview.
:meth:`~wx.html2.WebViewConfiguration.GetNativeConfiguration` Returns the pointer to the native configuration used during creation of a :ref:`wx.html2.WebView`.
:meth:`~wx.html2.WebViewConfiguration.SetDataPath` Set the data path for the webview.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.html2.WebViewConfiguration.Backend` See :meth:`~wx.html2.WebViewConfiguration.GetBackend`
:attr:`~wx.html2.WebViewConfiguration.DataPath` See :meth:`~wx.html2.WebViewConfiguration.GetDataPath` and :meth:`~wx.html2.WebViewConfiguration.SetDataPath`
:attr:`~wx.html2.WebViewConfiguration.NativeConfiguration` See :meth:`~wx.html2.WebViewConfiguration.GetNativeConfiguration`
================================================================================ ================================================================================
|
|api| 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().`
.. method:: 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".
:param `enable`:
:type `enable`: bool
:rtype: `bool`
:returns:
``True`` if the backend supports to modify this setting. ``False`` if the setting is not supported by the backend.
.. versionadded:: 4.3/wxWidgets-3.3.0
.. note::
This is only implemented on the Edge, WebKit2GTK+ and macOS backends.
.. method:: GetBackend(self)
Returns the backend identifier for which this configuration was created.
:rtype: `str`
.. method:: 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.
:rtype: `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.
.. method:: GetNativeConfiguration(self)
Returns the pointer to the native configuration used during creation of a :ref:`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 :ref:`wx.html2.WebView` must be created using the same :ref:`wx.html2.WebViewConfiguration` instance.
All settings **must** be set before creating a new web view with :meth:`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:
:rtype: `Any`
.. method:: 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.
:param `path`: The path to the data directory.
:type `path`: string
:rtype: `None`
.. note::
This is used by Edge, WebKit2GTK+ and Chromium backends (the latter creates "UserData" subdirectory under the given path).
.. attribute:: Backend
See :meth:`~wx.html2.WebViewConfiguration.GetBackend`
.. attribute:: DataPath
See :meth:`~wx.html2.WebViewConfiguration.GetDataPath` and :meth:`~wx.html2.WebViewConfiguration.SetDataPath`
.. attribute:: NativeConfiguration
See :meth:`~wx.html2.WebViewConfiguration.GetNativeConfiguration`