Settings#
Superclasses: Object
Control the behaviour of a WebView
.
Settings
can be applied to a WebView
to control text charset,
color, font sizes, printing mode, script support, loading of images and various
other things on a WebView
. After creation, a Settings
object
contains default settings.
// Disable JavaScript
WebKitSettings *settings = webkit_web_view_group_get_settings (my_view_group);
webkit_settings_set_enable_javascript (settings, FALSE);
Constructors#
Methods#
- class Settings
- apply_from_key_file(key_file: KeyFile, group_name: str) bool #
Reads the contents of the given
group_name
from the givenkey_file
and apply the value of each key/value to the corresponding property on thesettings
.Value types have to match with the corresponding setting property type and the group keys have to match existing setting property names. If those conditions are not met, the function will return
False
.Supported value types are strings (unquoted), booleans (0, 1, true, false) and unsigned integers.
Added in version 2.46.
- Parameters:
key_file – a
KeyFile
group_name – Name of the group to read from
key_file
- classmethod font_size_to_pixels() int #
Convert
points
to the equivalent value in pixels.Convert
points
to the equivalent value in pixels, based on the current screen DPI. Applications can use this function to convert font size values in points to font size values in pixels when setting the font size properties ofSettings
.Added in version 2.20.
- classmethod font_size_to_points() int #
Convert
pixels
to the equivalent value in points.Convert
pixels
to the equivalent value in points, based on the current screen DPI. Applications can use this function to convert font size values in pixels to font size values in points when getting the font size properties ofSettings
.Added in version 2.20.
- classmethod get_all_features() FeatureList #
Gets the list of all available WebKit features.
Features can be toggled with
set_feature_enabled
, and their current state determined withget_feature_enabled
.Note that most applications should use
get_development_features
andget_experimental_features
instead.Added in version 2.42.
- get_allow_file_access_from_file_urls() bool #
Get the
Settings
:allow-file-access-from-file-urls property.Added in version 2.10.
Get the
Settings
:allow-top-navigation-to-data-urls property.Added in version 2.28.
- get_allow_universal_access_from_file_urls() bool #
Get the
Settings
:allow-universal-access-from-file-urls property.Added in version 2.14.
- classmethod get_development_features() FeatureList #
Gets the list of available development WebKit features.
The returned features are a subset of those returned by
get_all_features
, and includes those which web and WebKit developers might find useful, but in general should not be exposed to end users; seeFeatureStatus
for more details.Added in version 2.42.
- get_disable_web_security() bool #
Get the
Settings
:disable-web-security property.Added in version 2.40.
- get_enable_2d_canvas_acceleration() bool #
Get the
Settings
:enable-2d-canvas-acceleration property.Added in version 2.46.
Get the
Settings
:enable-back-forward-navigation-gestures property.Added in version 2.24.
- get_enable_encrypted_media() bool #
Get the
Settings
:enable-encrypted-media property.Added in version 2.20.
- get_enable_javascript_markup() bool #
Get the
Settings
:enable-javascript-markup property.Added in version 2.24.
- get_enable_media_capabilities() bool #
Get the
Settings
:enable-media-capabilities property.Added in version 2.22.
- get_enable_media_stream() bool #
Get the
Settings
:enable-media-stream property.Added in version 2.4.
- get_enable_mock_capture_devices() bool #
Get the
Settings
:enable-mock-capture-devices property.Added in version 2.24.
- get_enable_offline_web_application_cache() bool #
Get the
Settings
:enable-offline-web-application-cache property.Deprecated since version 2.44: Please do not use it in newly written code
Get the
Settings
:enable-spatial-navigation property.Added in version 2.2.
- get_enable_webrtc() bool #
Get the
enable_webrtc
property.Added in version 2.38.
- get_enable_write_console_messages_to_stdout() bool #
Get the
Settings
:enable-write-console-messages-to-stdout property.Added in version 2.2.
- classmethod get_experimental_features() FeatureList #
Gets the list of available experimental WebKit features.
The returned features are a subset of those returned by
get_all_features
, and includes those which certain applications may want to expose to end users; seeFeatureStatus
for more details.Added in version 2.42.
- get_feature_enabled(feature: Feature) bool #
Gets whether a feature is enabled.
Added in version 2.42.
- Parameters:
feature – the feature to toggle.
- get_hardware_acceleration_policy() HardwareAccelerationPolicy #
Get the
Settings
:hardware-acceleration-policy property.Added in version 2.16.
- get_javascript_can_access_clipboard() bool #
Get the
Settings
:javascript-can-access-clipboard property.
- get_javascript_can_open_windows_automatically() bool #
Get the
Settings
:javascript-can-open-windows-automatically property.
- get_load_icons_ignoring_image_load_setting() bool #
Setting no longer supported. This function returns
False
.Deprecated since version 2.42: Please do not use it in newly written code
- get_media_content_types_requiring_hardware_support() str #
Gets the
Settings
:media-content-types-requiring-hardware-support property.Added in version 2.30.
- get_media_playback_requires_user_gesture() bool #
Get the
Settings
:media-playback-requires-user-gesture property.
- set_allow_file_access_from_file_urls(allowed: bool) None #
Set the
Settings
:allow-file-access-from-file-urls property.Added in version 2.10.
- Parameters:
allowed – Value to be set
- set_allow_modal_dialogs(allowed: bool) None #
Set the
Settings
:allow-modal-dialogs property.- Parameters:
allowed – Value to be set
Set the
Settings
:allow-top-navigation-to-data-urls property.Added in version 2.28.
- Parameters:
allowed – Value to be set
- set_allow_universal_access_from_file_urls(allowed: bool) None #
Set the
Settings
:allow-universal-access-from-file-urls property.Added in version 2.14.
- Parameters:
allowed – Value to be set
- set_auto_load_images(enabled: bool) None #
Set the
Settings
:auto-load-images property.- Parameters:
enabled – Value to be set
- set_cursive_font_family(cursive_font_family: str) None #
Set the
Settings
:cursive-font-family property.- Parameters:
cursive_font_family – the new default cursive font family
- set_default_charset(default_charset: str) None #
Set the
Settings
:default-charset property.- Parameters:
default_charset – default charset to be set
- set_default_font_family(default_font_family: str) None #
Set the
Settings
:default-font-family property.- Parameters:
default_font_family – the new default font family
- set_default_font_size(font_size: int) None #
Set the
Settings
:default-font-size property.- Parameters:
font_size – default font size to be set in pixels
- set_default_monospace_font_size(font_size: int) None #
Set the
Settings
:default-monospace-font-size property.- Parameters:
font_size – default monospace font size to be set in pixels
- set_disable_web_security(disabled: bool) None #
Set the
Settings
:disable-web-security property.Added in version 2.40.
- Parameters:
disabled – Value to be set
- set_draw_compositing_indicators(enabled: bool) None #
Set the
Settings
:draw-compositing-indicators property.- Parameters:
enabled – Value to be set
- set_enable_2d_canvas_acceleration(enabled: bool) None #
Set the
Settings
:enable-2d-canvas-acceleration property.Added in version 2.46.
- Parameters:
enabled – Value to be set
Set the
Settings
:enable-back-forward-navigation-gestures property.Added in version 2.24.
- Parameters:
enabled – value to be set
- set_enable_caret_browsing(enabled: bool) None #
Set the
Settings
:enable-caret-browsing property.- Parameters:
enabled – Value to be set
- set_enable_developer_extras(enabled: bool) None #
Set the
Settings
:enable-developer-extras property.- Parameters:
enabled – Value to be set
- set_enable_dns_prefetching(enabled: bool) None #
Set the
Settings
:enable-dns-prefetching property.- Parameters:
enabled – Value to be set
- set_enable_encrypted_media(enabled: bool) None #
Set the
Settings
:enable-encrypted-media property.Added in version 2.20.
- Parameters:
enabled – Value to be set
- set_enable_fullscreen(enabled: bool) None #
Set the
Settings
:enable-fullscreen property.- Parameters:
enabled – Value to be set
- set_enable_html5_database(enabled: bool) None #
Set the
Settings
:enable-html5-database property.- Parameters:
enabled – Value to be set
- set_enable_html5_local_storage(enabled: bool) None #
Set the
Settings
:enable-html5-local-storage property.- Parameters:
enabled – Value to be set
- set_enable_hyperlink_auditing(enabled: bool) None #
Set the
Settings
:enable-hyperlink-auditing property.- Parameters:
enabled – Value to be set
- set_enable_javascript(enabled: bool) None #
Set the
Settings
:enable-javascript property.- Parameters:
enabled – Value to be set
- set_enable_javascript_markup(enabled: bool) None #
Set the
Settings
:enable-javascript-markup property.Added in version 2.24.
- Parameters:
enabled – Value to be set
- set_enable_media(enabled: bool) None #
Set the
Settings
:enable-media property.Added in version 2.26.
- Parameters:
enabled – Value to be set
- set_enable_media_capabilities(enabled: bool) None #
Set the
Settings
:enable-media-capabilities property.Added in version 2.22.
- Parameters:
enabled – Value to be set
- set_enable_media_stream(enabled: bool) None #
Set the
Settings
:enable-media-stream property.Added in version 2.4.
- Parameters:
enabled – Value to be set
- set_enable_mediasource(enabled: bool) None #
Set the
Settings
:enable-mediasource property.Added in version 2.4.
- Parameters:
enabled – Value to be set
- set_enable_mock_capture_devices(enabled: bool) None #
Set the
Settings
:enable-mock-capture-devices property.Added in version 2.4.
- Parameters:
enabled – Value to be set
- set_enable_offline_web_application_cache(enabled: bool) None #
Setting no longer supported. This function does nothing.
Deprecated since version 2.44: Please do not use it in newly written code
- Parameters:
enabled – Value to be set
- set_enable_page_cache(enabled: bool) None #
Set the
Settings
:enable-page-cache property.- Parameters:
enabled – Value to be set
- set_enable_resizable_text_areas(enabled: bool) None #
Set the
Settings
:enable-resizable-text-areas property.- Parameters:
enabled – Value to be set
- set_enable_site_specific_quirks(enabled: bool) None #
Set the
Settings
:enable-site-specific-quirks property.- Parameters:
enabled – Value to be set
- set_enable_smooth_scrolling(enabled: bool) None #
Set the
Settings
:enable-smooth-scrolling property.- Parameters:
enabled – Value to be set
Set the
Settings
:enable-spatial-navigation property.Added in version 2.2.
- Parameters:
enabled – Value to be set
- set_enable_tabs_to_links(enabled: bool) None #
Set the
Settings
:enable-tabs-to-links property.- Parameters:
enabled – Value to be set
- set_enable_webaudio(enabled: bool) None #
Set the
Settings
:enable-webaudio property.- Parameters:
enabled – Value to be set
- set_enable_webgl(enabled: bool) None #
Set the
Settings
:enable-webgl property.- Parameters:
enabled – Value to be set
- set_enable_webrtc(enabled: bool) None #
Set the
enable_webrtc
property.Setting this property to
True
implies the media-stream web-setting will also be enabled.Added in version 2.38.
- Parameters:
enabled – Value to be set
- set_enable_write_console_messages_to_stdout(enabled: bool) None #
Set the
Settings
:enable-write-console-messages-to-stdout property.Added in version 2.2.
- Parameters:
enabled – Value to be set
- set_fantasy_font_family(fantasy_font_family: str) None #
Set the
Settings
:fantasy-font-family property.- Parameters:
fantasy_font_family – the new default fantasy font family
- set_feature_enabled(feature: Feature, enabled: bool) None #
Enables or disables a feature.
The current status of the feature can be determined with
webkit_settings_get_feature_enabled
. To reset a feature to its initial status, pass the value returned bywebkit_feature_get_default_value
as theenabled
parameter.Added in version 2.42.
- Parameters:
feature – the feature to toggle.
enabled – whether the feature will be enabled.
- set_hardware_acceleration_policy(policy: HardwareAccelerationPolicy) None #
Set the
Settings
:hardware-acceleration-policy property.Added in version 2.16.
- Parameters:
policy – a
HardwareAccelerationPolicy
- set_javascript_can_access_clipboard(enabled: bool) None #
Set the
Settings
:javascript-can-access-clipboard property.- Parameters:
enabled – Value to be set
- set_javascript_can_open_windows_automatically(enabled: bool) None #
Set the
Settings
:javascript-can-open-windows-automatically property.- Parameters:
enabled – Value to be set
- set_load_icons_ignoring_image_load_setting(enabled: bool) None #
Setting no longer supported. This function does nothing.
Deprecated since version 2.42: Please do not use it in newly written code
- Parameters:
enabled – Value to be set
- set_media_content_types_requiring_hardware_support(content_types: str | None = None) None #
Set the
Settings
:media-content-types-requiring-hardware-support property.Added in version 2.30.
- Parameters:
content_types – list of media content types requiring hardware support split by semicolons (:) or
None
to use the default value.
- set_media_playback_allows_inline(enabled: bool) None #
Set the
Settings
:media-playback-allows-inline property.- Parameters:
enabled – Value to be set
- set_media_playback_requires_user_gesture(enabled: bool) None #
Set the
Settings
:media-playback-requires-user-gesture property.- Parameters:
enabled – Value to be set
- set_minimum_font_size(font_size: int) None #
Set the
Settings
:minimum-font-size property.- Parameters:
font_size – minimum font size to be set in pixels
- set_monospace_font_family(monospace_font_family: str) None #
Set the
Settings
:monospace-font-family property.- Parameters:
monospace_font_family – the new default monospace font family
- set_pictograph_font_family(pictograph_font_family: str) None #
Set the
Settings
:pictograph-font-family property.- Parameters:
pictograph_font_family – the new default pictograph font family
- set_print_backgrounds(print_backgrounds: bool) None #
Set the
Settings
:print-backgrounds property.- Parameters:
print_backgrounds – Value to be set
- set_sans_serif_font_family(sans_serif_font_family: str) None #
Set the
Settings
:sans-serif-font-family property.- Parameters:
sans_serif_font_family – the new default sans-serif font family
- set_serif_font_family(serif_font_family: str) None #
Set the
Settings
:serif-font-family property.- Parameters:
serif_font_family – the new default serif font family
- set_user_agent(user_agent: str | None = None) None #
Set the
Settings
:user-agent property.- Parameters:
user_agent – The new custom user agent string or
None
to use the default user agent
- set_user_agent_with_application_details(application_name: str | None = None, application_version: str | None = None) None #
Set the
Settings
:user-agent property by appending the application details.Set the
Settings
:user-agent property by appending the application details to the default user agent. If no application name or version is given, the default user agent used will be used. If only the version is given, the default engine version is used with the given application name.- Parameters:
application_name – The application name used for the user agent or
None
to use the default user agent.application_version – The application version for the user agent or
None
to user the default version.
Properties#
- class Settings
- props.allow_file_access_from_file_urls: bool#
The type of the None singleton.
Added in version 2.10.
The type of the None singleton.
Added in version 2.28.
- props.allow_universal_access_from_file_urls: bool#
The type of the None singleton.
Added in version 2.14.
The type of the None singleton.
Added in version 2.24.
- props.enable_offline_web_application_cache: bool#
The type of the None singleton.
Deprecated since version 2.44: Please do not use it in newly written code
The type of the None singleton.
Added in version 2.4.
- props.enable_write_console_messages_to_stdout: bool#
The type of the None singleton.
Added in version 2.2.
- props.hardware_acceleration_policy: HardwareAccelerationPolicy#
The type of the None singleton.
Added in version 2.16.
- props.load_icons_ignoring_image_load_setting: bool#
The type of the None singleton.
Deprecated since version 2.42: Please do not use it in newly written code