- Qt 6.11
- Qt WebEngine
- QML Types
- WebEngineProfile
- Qt 6.11.1 Reference Documentation

# WebEngineProfile QML Type

Contains settings, scripts, and visited links common to multiple web engine views. More...

Import Statement: | `import QtWebEngine`
Since: | QtWebEngine 1.1
In C++: | QQuickWebEngineProfile

- List of all members, including inherited members

## Properties

- cachePath : string
- downloadPath : string `(since QtWebEngine 1.9)`
- httpAcceptLanguage : string `(since QtWebEngine 1.2)`
- httpCacheMaximumSize : int
- httpCacheType : enumeration
- httpUserAgent : string
- isPushServiceEnabled : bool `(since QtWebEngine 6.5)`
- offTheRecord : bool
- persistentCookiesPolicy : enumeration
- persistentPermissionsPolicy : enumeration `(since 6.8)`
- persistentStoragePath : string
- spellCheckEnabled : bool `(since QtWebEngine 1.4)`
- spellCheckLanguages : list<string> `(since QtWebEngine 1.4)`
- storageName : string
- userScripts : WebEngineScriptCollection

## Signals

- clearHttpCacheCompleted() `(since QtWebEngine 6.7)`
- downloadFinished(WebEngineDownloadRequest download)
- downloadRequested(WebEngineDownloadRequest download)
- presentNotification(WebEngineNotification notification) `(since QtWebEngine 1.9)`

## Methods

- void clearHttpCache() `(since QtWebEngine 1.3)`
- list<webEnginePermission> listAllPermissions() `(since 6.8)`
- list<webEnginePermission> listPermissionsForOrigin(url securityOrigin) `(since 6.8)`
- list<webEnginePermission> listPermissionsForPermissionType(WebEnginePermission.PermissionType permissionType) `(since 6.8)`
- void queryPermission(url securityOrigin, WebEnginePermission.PermissionType permissionType) `(since 6.8)`

## Detailed Description

WebEngineProfile contains settings, scripts, and the list of visited links shared by all views that belong to the profile.

Information about visited links is stored together with persistent cookies and other persistent data in a storage determined by the storageName property. Persistent data is stored in a subdirectory determined by the persistentStoragePath property and the cache in a subdirectory determined by the cachePath property. The httpCacheType property describes the type of the cache: in-memory or on-disk. If only the storageName property is set, the other values are generated automatically based on it. If you specify any of the values manually, you should do it before creating any pages that belong to the profile.

Profiles can be used to isolate pages from each other. A typical use case is a dedicated off-the-record profile for a private browsing mode. An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data to be stored only in memory. The offTheRecord property holds whether a profile is off-the-record.

Each web engine view has an associated profile. Views that do not have a specific profile set share a common one, which is off-the-record by default.

Note: It is recommended to use the new WebEngineProfilePrototype for profile creation from 6.9

## Property Documentation

### cachePath : string

The path to the location where the profile's caches are stored, in particular the HTTP cache.

By default, the caches are stored below QStandardPaths::writableLocation(QStandardPaths::CacheLocation) in a directory named using storageName.

### downloadPath : string `[since QtWebEngine 1.9]`

The path to the location where the downloaded files are stored.

Overrides the default path used for download location.

If set to an empty string, the default path is restored.

Note: By default, the download path is QStandardPaths::DownloadLocation.

This property was introduced in QtWebEngine 1.9.

### httpAcceptLanguage : string `[since QtWebEngine 1.2]`

The value of the Accept-Language HTTP request-header field.

This property was introduced in QtWebEngine 1.2.

### httpCacheMaximumSize : int

The maximum size of the HTTP cache. If `0`, the size will be controlled automatically by QtWebEngine. The default value is `0`.

See also httpCacheType.

### httpCacheType : enumeration

This enumeration describes the type of the HTTP cache:

Constant | Description
--- | ---
`WebEngineProfile.MemoryHttpCache` | Uses an in-memory cache. This is the only setting possible if offTheRecord is set or no storageName is available, which is the default.
`WebEngineProfile.DiskHttpCache` | Uses a disk cache. This is the default value for non off-the-record profile with storageName.
`WebEngineProfile.NoCache` | Disables caching. (Added in 5.7)

### httpUserAgent : string

The user-agent string sent with HTTP to identify the browser.

Note: On Windows 8.1 and newer, the default user agent will always report "Windows NT 6.2" (Windows 8), unless the application does contain a manifest that declares newer Windows versions as supported.

### isPushServiceEnabled : bool `[since QtWebEngine 6.5]`

Whether the push messaging service is enabled.

Note: By default the push messaging service is disabled.

Note: Qt WebEngine uses the Firebase Cloud Messaging (FCM) as a browser push service. Therefore, all push messages will go through the Google push service and its respective servers.

This property was introduced in QtWebEngine 6.5.

### offTheRecord : bool

Whether the web engine profile is off-the-record. An off-the-record profile forces cookies, the HTTP cache, and other normally persistent data to be stored only in memory. Profile is off-the-record by default.

Changing a profile from off-the-record to disk-based behavior also requires setting a proper storageName.

See also storageName.

### persistentCookiesPolicy : enumeration

This enumeration describes the policy of cookie persistence:

Constant | Description
--- | ---
`WebEngineProfile.NoPersistentCookies` | Both session and persistent cookies are stored in memory. This is the only setting possible if offTheRecord is set or no storageName is available, which is the default.
`WebEngineProfile.AllowPersistentCookies` | Cookies marked persistent are saved to and restored from disk, whereas session cookies are only stored to disk for crash recovery. This is the default value for non off-the-record profile with storageName.
`WebEngineProfile.OnlyPersistentCookies` | Cookies marked persistent are saved to and restored from disk, whereas session cookies are never stored to disk, even for crash recovery.
`WebEngineProfile.ForcePersistentCookies` | Both session and persistent cookies are saved to and restored from disk.

### persistentPermissionsPolicy : enumeration `[since 6.8]`

This enumeration describes the policy for permission persistence:

Constant | Description
--- | ---
`WebEngineProfile.AskEveryTime` | The application will ask for permissions every time they're needed, regardless of whether they've been granted before or not. This is intended for backwards compatibility with existing applications, and otherwise not recommended.
`WebEngineProfile.StoreInMemory` | A request will be made only the first time a permission is needed. Any subsequent requests will be automatically granted or denied, depending on the initial user choice. This carries over to all pages using the same QWebEngineProfile instance, until the application is shut down. This is the setting applied if `off-the-record` is set or no persistent data path is available.
`WebEngineProfile.StoreOnDisk` | Works the same way as `PersistentPermissionsInMemory`, but the permissions are saved to and restored from disk. This is the default setting.

This property was introduced in Qt 6.8.

### persistentStoragePath : string

The path to the location where the persistent data for the browser and web content are stored. Persistent data includes persistent cookies, HTML5 local storage, and visited links.

By default, the storage is located below QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) in a directory named using storageName.

### spellCheckEnabled : bool `[since QtWebEngine 1.4]`

This property holds whether the web engine spell checker is enabled.

This property was introduced in QtWebEngine 1.4.

### spellCheckLanguages : list<string> `[since QtWebEngine 1.4]`

This property holds the list of languages used by the spell checker. Each language should match the name of the `.bdic` dictionary. For example, the language `en-US` will load the `en-US.bdic` dictionary file.

See the Spellchecker feature documentation for how dictionary files are searched.

For more information about how to compile `.bdic` dictionaries, see the Spellchecker Example.

This property was introduced in QtWebEngine 1.4.

### storageName : string

The storage name that is used to create separate subdirectories for each profile that uses the disk for storing persistent data and cache.

See also WebEngineProfile::persistentStoragePath and WebEngineProfile::cachePath.

### userScripts : WebEngineScriptCollection `[read-only]`

The collection of WebEngineScript objects that are injected into all pages that share this profile.

## Signal Documentation

### `[since QtWebEngine 6.7]` clearHttpCacheCompleted()

This signal is emitted when the clearHttpCache() operation is completed.

Note: The corresponding handler is `onClearHttpCacheCompleted`.

This signal was introduced in QtWebEngine 6.7.

See also clearHttpCache().

### downloadFinished(WebEngineDownloadRequest download)

This signal is emitted whenever downloading stops, because it finished successfully, was cancelled, or was interrupted (for example, because connectivity was lost). The download argument holds the state of the finished download instance.

Note: The corresponding handler is `onDownloadFinished`.

### downloadRequested(WebEngineDownloadRequest download)

This signal is emitted whenever a download has been triggered. The download argument holds the state of the download. The download has to be explicitly accepted with WebEngineDownloadRequest::accept() or the download will be cancelled by default.

Note: The corresponding handler is `onDownloadRequested`.

### `[since QtWebEngine 1.9]` presentNotification(WebEngineNotification notification)

This signal is emitted whenever there is a newly created user notification. The notification argument holds the WebEngineNotification instance to query data and interact with.

Note: The corresponding handler is `onPresentNotification`.

This signal was introduced in QtWebEngine 1.9.

## Method Documentation

### `[since QtWebEngine 1.3]` void clearHttpCache()

Removes the profile's cache entries.

Note: Make sure that you do not start new navigation or any operation on the profile while the clear operation is in progress. The clearHttpCacheCompleted() signal notifies about the completion.

This method was introduced in QtWebEngine 1.3.

See also WebEngineProfile::cachePath and clearHttpCacheCompleted().

### `[since 6.8]` list<webEnginePermission> listAllPermissions()

Returns a list of webEnginePermission objects, each one representing a single permission currently present in the permissions store. The returned list contains all previously granted/denied permissions for this profile, provided they are of a persistent type.

Note: When the persistentPermissionPolicy property is set to `AskEveryTime`, this will return an empty list.

This method was introduced in Qt 6.8.

See also queryPermission(), listPermissionsForOrigin(), listPermissionsForPermissionType(), and webEnginePermission::isPersistent().

### `[since 6.8]` list<webEnginePermission> listPermissionsForOrigin(url securityOrigin)

Returns a list of webEnginePermission objects, each one representing a single permission currently present in the permissions store. The returned list contains all previously granted/denied permissions associated with a specific securityOrigin for this profile, provided they are of a persistent type.

Note: Since permissions are granted on a per-origin basis, the provided securityOrigin will be stripped to its origin form, and the returned list will contain all permissions for the origin. Thus, passing https://www.example.com/some/page.html is the same as passing just https://www.example.com/.

Note: When persistentPermissionPolicy() is set to `AskEveryTime`, this will return an empty list.

This method was introduced in Qt 6.8.

See also queryPermission(), listAllPermissions(), listPermissionsForPermissionType(), and webEnginePermission::isPersistent().

### `[since 6.8]` list<webEnginePermission> listPermissionsForPermissionType(WebEnginePermission.PermissionType permissionType)

Returns a list of webEnginePermission objects, each one representing a single permission currently present in the permissions store. The returned list contains all previously granted/denied permissions of the provided permissionType. If the permissionType is non-persistent, the list will be empty.

Note: When persistentPermissionPolicy() is set to `AskEveryTime`, this will return an empty list.

This method was introduced in Qt 6.8.

See also queryPermission(), listAllPermissions(), listPermissionsForOrigin(), and webEnginePermission::isPersistent().

### `[since 6.8]` void queryPermission(url securityOrigin, WebEnginePermission.PermissionType permissionType)

Returns a webEnginePermission object corresponding to a single permission for the provided securityOrigin and permissionType. The object may be used to query for the current state of the permission, or to change it. It is not required for a permission to already exist; the returned object may also be used to pre-grant a permission if a website is known to use it.

Note: This may only be used for persistent permission types. Calling it with a non-persistent permissionType will return an invalid object.

This method was introduced in Qt 6.8.

See also listAllPermissions(), listPermissionsForOrigin(), and listPermissionsForPermissionType().