WebEngineSettings QML Type

Allows configuration of browser properties and attributes. More...

Import Statement: import QtWebEngine
Since: QtWebEngine 1.1

Properties

Detailed Description

The WebEngineSettings type can be used to configure browser properties and generic attributes, such as JavaScript support, focus behavior, and access to remote content. This type is uncreatable, but the default settings for all web engine views can be accessed by using the WebEngine.settings property.

Each web engine view can have individual settings that can be accessed by using the WebEngineView.settings property.

Property Documentation

accelerated2dCanvasEnabled : bool [since QtWebEngine 1.3]

Specifies whether the HTML 5 2D canvas should be an OpenGL framebuffer. This makes many painting operations faster, but slows down pixel access.

Enabled by default if available.

This property was introduced in QtWebEngine 1.3.


allowGeolocationOnInsecureOrigins : bool [since QtWebEngine 1.5]

Since Qt 5.7, only secure origins such as HTTPS have been able to request Geolocation features. This provides an override to allow non secure origins to access Geolocation again.

Disabled by default.

This property was introduced in QtWebEngine 1.5.


allowRunningInsecureContent : bool [since QtWebEngine 1.4]

By default, HTTPS pages cannot run JavaScript, CSS, plugins or web-sockets from HTTP URLs. This used to be possible and this provides an override to get the old behavior.

Disabled by default.

This property was introduced in QtWebEngine 1.4.


allowWindowActivationFromJavaScript : bool [since QtWebEngine 1.6]

Allows the window.focus() method in JavaScript. Disallowed by default.

This property was introduced in QtWebEngine 1.6.


autoLoadIconsForPage : bool [since QtWebEngine 1.3]

Automatically downloads icons for web pages.

Enabled by default.

This property was introduced in QtWebEngine 1.3.


autoLoadImages : bool

Automatically loads images on web pages.

Enabled by default.


defaultTextEncoding : string [since QtWebEngine 1.2]

Sets the default encoding. The value must be a string describing an encoding such as "utf-8" or "iso-8859-1".

If left empty, a default value will be used.

This property was introduced in QtWebEngine 1.2.


dnsPrefetchEnabled : bool [since QtWebEngine 1.8]

Enables speculative prefetching of DNS records for HTML links before they are activated.

Disabled by default.

This property was introduced in QtWebEngine 1.8.


errorPageEnabled : bool

Enables displaying the built-in error pages of Chromium.

Enabled by default.


focusOnNavigationEnabled : bool [since QtWebEngine 1.4]

Focus is given to the view whenever a navigation operation occurs (load, stop, reload, reload and bypass cache, forward, backward, set content, and so on).

Disabled by default.

This property was introduced in QtWebEngine 1.4.


forceDarkMode : bool [since QtWebEngine 6.7]

Automatically render all web contents using a dark theme.

Disabled by default.

This property was introduced in QtWebEngine 6.7.


fullscreenSupportEnabled : bool [since QtWebEngine 1.2]

Tells the web engine whether fullscreen is supported in this application or not.

Disabled by default.

This property was introduced in QtWebEngine 1.2.


hyperlinkAuditingEnabled : bool

Enables support for the ping attribute for hyperlinks.

Disabled by default.


imageAnimationPolicy : enumeration [since QtWebEngine 6.8]

Specifies how an image animation should be handled when the image frames are rendered for animation.

ConstantDescription
WebEngineSettings.ImageAnimationPolicy.AllowAllows all image animations when the image frames are rendered.
WebEngineSettings.ImageAnimationPolicy.AnimateOnceAnimate the image once when the image frames are rendered.
WebEngineSettings.ImageAnimationPolicy.DisallowDisallows all image animations when the image frames are rendered.

Default value is WebEngineSettings.ImageAnimationPolicy.Allow.

This property was introduced in QtWebEngine 6.8.


javascriptCanAccessClipboard : bool

Allows JavaScript programs to write (copy) sanitized content to the clipboard. A sanitized write is done with the write and writeText JavaScript Clipboard API calls and must be accompanied by user action.

Unsanitized writes, and reading from the clipboard, are enabled by javascriptCanPaste.

Prior to Chromium version 81, this setting enabled all clipboard writes.

Since unrestricted clipboard access is a potential security concern, it is recommended that applications leave this disabled and instead respond to ClipboardReadWrite feature permission requests.

Disabled by default.


javascriptCanOpenWindows : bool

Allows JavaScript programs to open popup windows without user interaction.

Enabled by default.


javascriptCanPaste : bool [since QtWebEngine 1.7]

Allows JavaScript programs to read (paste) from the clipboard and to write unsanitized content. A sanitized write is done with the write and writeText JavaScript Clipboard API calls and must be accompanied by user action; unsanitized writes are any writes which do not meet these criteria.

For this setting to have any effect, javascriptCanAccessClipboard must also be enabled.

Since unrestricted clipboard access is a potential security concern, it is recommended that applications leave this disabled and instead respond to ClipboardReadWrite feature permission requests.

Disabled by default.

This property was introduced in QtWebEngine 1.7.


javascriptEnabled : bool

Enables the running of JavaScript programs.

Enabled by default.


jsTouchEventsEnabled : bool [since QtWebEngine 6.9]

Enables support for JavaScript touch events API, meaning ontouchstart, ontouchend and ontouchmove handlers will be present in the document.window object.

Note that some websites use this API to decide whether they run on a mobile device or on desktop and base their design on it. This can cause unwanted results on touchscreen laptops or other setups that emulate a fake touch device.

Enabled by default if a touch device detected by the system and disabled otherwise.

This property was introduced in QtWebEngine 6.9.


linksIncludedInFocusChain : bool

Includes hyperlinks in the keyboard focus chain.

Enabled by default.


localContentCanAccessFileUrls : bool

Allows locally loaded documents to access other local URLs.

Enabled by default.


localContentCanAccessRemoteUrls : bool

Allows locally loaded documents to access remote URLs.

Disabled by default.


localStorageEnabled : bool

Enables support for the HTML 5 local storage feature.

Enabled by default.


Specifies that navigations can be triggered by dropping URLs on the view.

Enabled by default.

This property was introduced in QtWebEngine 6.4.


pdfViewerEnabled : bool [since QtWebEngine 1.9]

Specifies that PDF documents will be opened in the internal PDF viewer instead of being downloaded.

Enabled by default.

This property was introduced in QtWebEngine 1.9.


playbackRequiresUserGesture : bool [since QtWebEngine 1.7]

Inhibits playback of media content until the user interacts with the page.

By default, Qt WebEngine uses Chromium settings, as described in Autoplay Policy Changes. To overwrite the default behavior, this property must be set to false.

Note: The behavior is similar to Chrome on Android when enabled, and similar to Chrome on desktops when disabled.

This property was introduced in QtWebEngine 1.7.


pluginsEnabled : bool

Enables support for Pepper plugins, such as the Flash player.

Disabled by default.


preferCSSMarginsForPrinting : bool [since QtWebEngine 6.9]

Turns on preferring CSS margins over the default (0, 0, 0, 0) sizes when printing a web page.

Disabled by default.

This property was introduced in QtWebEngine 6.9.


printElementBackgrounds : bool [since QtWebEngine 1.4]

Turns on printing of CSS backgrounds when printing a web page.

Enabled by default.

This property was introduced in QtWebEngine 1.4.


printHeaderAndFooter : bool [since QtWebEngine 6.9]

Specifies that printing results will contain basic page information (URL, title, date, page number) in header and footer area. It is the embedder's responsibility to provide enough space for these texts by setting proper top and bottom margins.

Disabled by default.

This property was introduced in QtWebEngine 6.9.


readingFromCanvasEnabled : bool [since QtWebEngine 6.6]

Specifies that reading from all canvas elements is enabled.

This setting will have impact on all HTML5 canvas elements irrespective of origin, and can be disabled to prevent canvas fingerprinting.

Enabled by default.

This property was introduced in QtWebEngine 6.6.


screenCaptureEnabled : bool [since QtWebEngine 1.3]

Tells the web engine whether screen capture is supported in this application or not.

Disabled by default.

This property was introduced in QtWebEngine 1.3.


scrollAnimatorEnabled : bool [since QtWebEngine 6.8]

Enables animated scrolling.

Disabled by default.

This property was introduced in QtWebEngine 6.8.


showScrollBars : bool [since QtWebEngine 1.6]

Shows scroll bars. Enabled by default.

This property was introduced in QtWebEngine 1.6.


spatialNavigationEnabled : bool

Enables the Spatial Navigation feature, which means the ability to navigate between focusable elements, such as hyperlinks and form controls, on a web page by using the Left, Right, Up and Down arrow keys.

For example, if a user presses the Right key, heuristics determine whether there is an element they might be trying to reach towards the right and which element they probably want.

Disabled by default.


touchIconsEnabled : bool [since QtWebEngine 1.3]

Enables support for touch icons and precomposed touch icons.

Disabled by default.

This property was introduced in QtWebEngine 1.3.


unknownUrlSchemePolicy : enumeration [since QtWebEngine 1.7]

Specifies how navigation requests to URLs with unknown schemes are handled.

ConstantDescription
WebEngineSettings.DisallowUnknownUrlSchemesDisallows all navigation requests to URLs with unknown schemes.
WebEngineSettings.AllowUnknownUrlSchemesFromUserInteractionAllows navigation requests to URLs with unknown schemes that are issued from user-interaction (like a mouse-click), whereas other navigation requests (for example from JavaScript) are suppressed.
WebEngineSettings.AllowAllUnknownUrlSchemesAllows all navigation requests to URLs with unknown schemes.

Default value is WebEngineSettings.AllowUnknownUrlSchemesFromUserInteraction.

This property was introduced in QtWebEngine 1.7.


webGLEnabled : bool [since QtWebEngine 1.3]

Enables support for HTML 5 WebGL.

Enabled by default if available.

This property was introduced in QtWebEngine 1.3.


webRTCPublicInterfacesOnly : bool [since QtWebEngine 1.7]

Limits WebRTC to public IP addresses only. When disabled WebRTC may also use local network IP addresses, but remote hosts can also see your local network IP address.

Disabled by default.

This property was introduced in QtWebEngine 1.7.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.