webkit.web_context

Module for [WebContext] class

Types 3

Manages aspects common to all #WebKitWebView<!-- -->s

The #WebKitWebContext manages all aspects common to all #WebKitWebView<!-- -->s.

You can define the #WebKitCacheModel with [webkit.web_context.WebContext.setCacheModel], depending on the needs of your application. You can access the #WebKitSecurityManager to specify the behaviour of your application regarding security using [webkit.web_context.WebContext.getSecurityManager].

It is also possible to change your preferred language or enable spell checking, using [webkit.web_context.WebContext.setPreferredLanguages], [webkit.web_context.WebContext.setSpellCheckingLanguages] and [webkit.web_context.WebContext.setSpellCheckingEnabled].

You can use [webkit.web_context.WebContext.registerUriScheme] to register custom URI schemes, and manage several other settings.

TLS certificate validation failure is now treated as a transport error by default. To handle TLS failures differently, you can connect to #WebKitWebView::load-failed-with-tls-errors. Alternatively, you can use webkit_web_context_set_tls_errors_policy() to set the policy [webkit.types.TLSErrorsPolicy.Ignore]; however, this is not appropriate for Internet applications.

Methods
GType _gType() @property
WebContext self()Returns `this`, for use in `with` statements.
WebContextGidBuilder builder()Get builder for [webkit.web_context.WebContext] Returns: New builder object
string timeZoneOverride() @propertyGet `timeZoneOverride` property. Returns: The timezone override for this web context. Setting this property provides a better alternative to configure the timezone information for all webviews mana...
webkit.web_context.WebContext getDefault()Gets the default web context. Returns: a #WebKitWebContext
void addPathToSandbox(string path, bool readOnly)Adds a path to be mounted in the sandbox.
webkit.types.CacheModel getCacheModel()Returns the current cache model.
webkit.geolocation_manager.GeolocationManager getGeolocationManager()Get the #WebKitGeolocationManager of context. Returns: the #WebKitGeolocationManager of context.
webkit.network_session.NetworkSession getNetworkSessionForAutomation()Get the #WebKitNetworkSession used for automation sessions started in context. Returns: a #WebKitNetworkSession, or null if automation is not enabled
webkit.security_manager.SecurityManager getSecurityManager()Get the #WebKitSecurityManager of context. Returns: the #WebKitSecurityManager of context.
bool getSpellCheckingEnabled()Get whether spell checking feature is currently enabled. Returns: true If spell checking is enabled, or false otherwise.
string[] getSpellCheckingLanguages()Get the the list of spell checking languages.
string getTimeZoneOverride()Get the #WebKitWebContext:time-zone-override property. Returns:
void initializeNotificationPermissions(webkit.security_origin.SecurityOrigin[] allowedOrigins, webkit.security_origin.SecurityOrigin[] disallowedOrigins)Sets initial desktop notification permissions for the context.
bool isAutomationAllowed()Get whether automation is allowed in context.
void registerUriScheme(string scheme, webkit.types.URISchemeRequestCallback callback)Register scheme in context.
void sendMessageToAllExtensions(webkit.user_message.UserMessage message)Send message to all web process extensions associated to context.
void setAutomationAllowed(bool allowed)Set whether automation is allowed in context.
void setCacheModel(webkit.types.CacheModel cacheModel)Specifies a usage model for WebViews.
void setPreferredLanguages(string[] languages = null)Set the list of preferred languages.
void setSpellCheckingEnabled(bool enabled)Enable or disable the spell checking feature.
void setSpellCheckingLanguages(string[] languages)Set the list of spell checking languages to be used for spell checking.
void setWebProcessExtensionsDirectory(string directory)Set the directory where WebKit will look for web process extensions.
void setWebProcessExtensionsInitializationUserData(glib.variant.Variant userData)Set user data to be passed to Web Extensions on initialization.
gulong connectAutomationStarted(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : webkit.automation_session.AutomationSession))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : webkit.web_context.WebContext))) && Parameters!T.length < 3)Connect to `AutomationStarted` signal.
gulong connectInitializeNotificationPermissions(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : webkit.web_context.WebContext))) && Parameters!T.length < 2)Connect to `InitializeNotificationPermissions` signal.
gulong connectInitializeWebProcessExtensions(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : webkit.web_context.WebContext))) && Parameters!T.length < 2)Connect to `InitializeWebProcessExtensions` signal.
gulong connectUserMessageReceived(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : webkit.user_message.UserMessage))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : webkit.web_context.WebContext))) && Parameters!T.length < 3)Connect to `UserMessageReceived` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Create a new #WebKitWebContext. Returns: a newly created #WebKitWebContext
Methods
T memoryPressureSettings(webkit.memory_pressure_settings.MemoryPressureSettings propval)Set `memoryPressureSettings` property. Params: propval = The #WebKitMemoryPressureSettings applied to the web processes created by this context. Returns: Builder instance for fluent chaining
T timeZoneOverride(string propval)Set `timeZoneOverride` property. Params: propval = The timezone override for this web context. Setting this property provides a better alternative to configure the timezone information for all webv...

Fluent builder for [webkit.web_context.WebContext]

Methods