Qt WebKit

The WebView API allows QML applications to render regions of dynamic web content. A WebView component may share the screen with other QML components or encompass the full screen as specified within the QML application.

QML WebView version 3.0 is incompatible with previous QML WebView API versions. It allows an application to load pages into the WebView, either by URL or with an HTML string, and navigate within session history. By default, links to different pages load within the same WebView, but applications may intercept requests to delegate links to other functions.

This sample QML application loads a web page, responds to session history context, and intercepts requests for external links:

import QtQuick 2.0
import QtWebKit 3.0

Page {
    WebView {
        id: webview
        url: "http://qt-project.org"
        width: parent.width
        height: parent.height
        onNavigationRequested: {
            // detect URL scheme prefix, most likely an external link
            var schemaRE = /^\w+:/;
            if (schemaRE.test(request.url)) {
                request.action = WebView.AcceptRequest;
            } else {
                request.action = WebView.IgnoreRequest;
                // delegate request.url here
            }
        }
    }
}

Examples

There are several Qt WebKit examples located in the Qt WebKit Examples page.