- Qt 6.11
- Qt WebEngine
- Deploying Qt WebEngine Applications
- Qt 6.11.1 Reference Documentation

Debugging and Profiling ◦ Porting from Qt WebKit to Qt WebEngine

# Deploying Qt WebEngine Applications

The way to package and deploy applications varies between operating systems. For Windows and macOS, windeployqt and macdeployqt automate the steps to generate a stand-alone application package.

When manually deploying applications that depend on Qt WebEngine, all the files that are required to run the application have to be included: libraries, QML imports, plugins, and translations.

For more information, see Deploying Qt Applications.

## Target Platforms

Qt WebEngine does try to support all Supported Platforms of Qt. However, due to different requirements of Chromium this is not always possible. Known limitations are:

- Qt WebEngine currently supports only Windows, Linux, and macOS.
- On Windows, Qt WebEngine only supports Windows Vista or newer as target platform. Due to use of newer API in Chromium, Windows XP is not supported. WinRT is not supported, either.
- On Windows, the Visual C++ Redistributable version 14.28 or higher is needed to run Qt WebEngine applications.

## Deploying Applications Manually

When manually deploying applications that depend on Qt WebEngine, the following files might have to be deployed:

- Libraries
- QML imports
- Qt WebEngine process
- Resources
- Translations
- Audio and video codecs

### Deploying Libraries

The following libraries must be deployed with applications that depend on Qt WebEngine:

- QtWebEngineCore library
- QtWebEngineWidgets or QtWebEngine libraries, depending on application type

### Deploying QML Imports

If Qt Quick integration is used in the application, the QtWebEngine import directory needs to be deployed.

### Deploying Qt WebEngine Processes

Qt WebEngine takes advantage of the multi-process model that the Chromium project offers. The multi-process model requires that the Qt WebEngine Process executable be deployed alongside your application.

The WebEngine process is executed for each QWebEngineView or WebEngineView instance. For example, a browser application with two tabs open should have two separate instances of the process running. This is a common approach used by most modern web engines to provide a stable browsing experience.

At runtime, Qt WebEngine looks for the `QtWebEngineProcess` executable in the directory that QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) returns. For Qt installations, this is `QTDIR/libexec` (Linux) or `QTDIR\bin` (Windows). The path can be changed by defining a `qt.conf` file, for example. Alternatively, an executable path can be set as a value of the `QTWEBENGINEPROCESS_PATH` environment variable. On macOS, Qt WebEngine looks for the executable in `.app/Helpers/QtWebEngineProcess`.

### Deploying Resources

Qt WebEngine requires the following resource files:

- `qtwebengine_resources.pak` contains the resources needed by Chromium.
- `qtwebengine_devtools_resources.pak` contains tools for remote debugging.
- `qtwebengine_resources_100p.pak` contains images suitable for low resolution displays.
- `qtwebengine_resources_200p.pak` contains images suitable for high DPI displays.
- `icudtl.dat` provides support for International Components for Unicode (ICU). It is the Chromium version of ICU, which is not needed if Qt WebEngine was configured to use the system ICU.
- `v8_context_snapshot.bin` contains a previously prepared snapshot of a v8 context used to speed up initialization. Debug builds use separate snapshots with the file name extension `.debug.bin` instead of `.bin`. On macOS, there is a snapshot for each architecture named accordingly, for example `v8_context_snapshot.arm64.bin` or `v8_context_snapshot.arm64.debug.bin`.

Resources are searched from the following locations:

- On Linux and Windows: the `resources` directory in the directory specified by QLibraryInfo::location(QLibraryInfo::DataPath)
- On macOS: `.app/Content/Resources`
- The application directory specified by QCoreApplication::applicationDirPath()

Alternatively, a resources directory path can be set as a value of the `QTWEBENGINE_RESOURCES_PATH` environment variable, or via the command-line:

     --webEngineArgs --webengine-resources-path=<path>

When an override is set, the application looks for resources only inside the provided directory, and nowhere else.

### Translations

Locale data (such as `en-US.pak`) is searched form the following locations:

- On macOS: `.app/Content/Resources`
- On Linux and Windows: `qtwebengine_locales` directory in the directory specified by QLibraryInfo::location(QLibraryInfo::TranslationsPath)

Alternatively, a locales directory path can be set as a value of the `QTWEBENGINE_LOCALES_PATH` environment variable, or via the command-line:

     --webEngineArgs --webengine-locales-path=<path>

When an override is set, the application looks for locales only inside the provided directory, and nowhere else.

### JavaScript Files in Qt Resource Files

If your WebEngine application is built using the Qt Quick Compiler, and the application ships JavaScript files inside .qrc resources, and these files are supposed to be loaded from inside HTML pages, make sure to specify the resource files in a `QTQUICK_COMPILER_SKIPPED_RESOURCES` qmake variable inside your project. This prevents the Qt Quick Compiler from trying to generate C++ code for the corresponding JavaScript code, as well as removing the original JavaScript code from the Qt resources file, which would lead to broken HTML pages. For example:

     QTQUICK_COMPILER_SKIPPED_RESOURCES += resources/my_resource.qrc

### macOS Specific Deployment Steps

To deploy a Qt WebEngine application on macOS, you will need to ensure that the Qt WebEngine process is signed with an entitlements file that at least contains the entitlements listed in QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/Resources/QtWebEngineProcess.entitlements.

To deploy a Qt WebEngine application that accesses the microphone or camera on macOS, you will need to provide texts for the messages that will be shown to the user to explain why the application asks for permission to access to the camera or microphone. To do this, add the texts to the application's `Info.plist` file using the keys described below.

For the camera usage message, provide a text using the following key:

     <key>NSCameraUsageDescription</key>
     <string>Your message text for camera usage.</string>

See also Apple's property list file documentation.

For the microphone usage message, provide a text using the following key:

     <key>NSMicrophoneUsageDescription</key>
     <string>Your message text for microphone usage.</string>

See also Apple's property list file documentation.

To notarize an application that accesses the camera or the microphone, you will need to add the corresponding keys to your application's entitlements file used for deployment and notarization.

To enable access to the camera, add:

     <key>com.apple.security.device.camera</key>
     <true/>

See also Apple's camera entitlement documentation.

To enable access to the microphone, add:

     <key>com.apple.security.device.microphone</key>
     <true/>

See also Apple's microphone entitlement documentation.

Debugging and Profiling ◦ Porting from Qt WebKit to Qt WebEngine