summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2022-11-30 11:01:20 +0100
committerMichal Klocek <michal.klocek@qt.io>2022-11-30 13:18:47 +0100
commit8d8db70ae79ddff585be1270318b46b9d541117a (patch)
treebcc79c161e3718094efd2e33ae6b3cf82929081c
parent4769dee166200d4de9260f85c5fbfd7191611bf6 (diff)
Mention WebSockets in docs
QtWebChannel has an example for a use case of HTML web sockets and connectivity of the native side of application. We don't need to create a new example of our own by mentioning this. However, the chat client application uses JS libraries served from remote, so we have to enable LocalContentCanAccessRemoteUrls setting to make it work out of the box in WebEngine example browsers. Desktop Chrome works the same way by default. Task-number: QTBUG-106505 Change-Id: I9020d0a09a88de16d32af063aee5d55c9837f484 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit d1607c91dff1d02621c64cc93d3c1a246ce4fe9f)
-rw-r--r--examples/webenginequick/quicknanobrowser/BrowserWindow.qml2
-rw-r--r--examples/webenginewidgets/simplebrowser/browser.cpp2
-rw-r--r--src/core/doc/src/qtwebengine-features.qdoc16
3 files changed, 20 insertions, 0 deletions
diff --git a/examples/webenginequick/quicknanobrowser/BrowserWindow.qml b/examples/webenginequick/quicknanobrowser/BrowserWindow.qml
index 7c2a21cd5..ef4af5d4f 100644
--- a/examples/webenginequick/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webenginequick/quicknanobrowser/BrowserWindow.qml
@@ -510,6 +510,8 @@ ApplicationWindow {
}
}
]
+ settings.localContentCanAccessRemoteUrls: true
+ settings.localContentCanAccessFileUrls: false
settings.autoLoadImages: appSettings.autoLoadImages
settings.javascriptEnabled: appSettings.javaScriptEnabled
settings.errorPageEnabled: appSettings.errorPageEnabled
diff --git a/examples/webenginewidgets/simplebrowser/browser.cpp b/examples/webenginewidgets/simplebrowser/browser.cpp
index c1f5ddd55..f1ed68739 100644
--- a/examples/webenginewidgets/simplebrowser/browser.cpp
+++ b/examples/webenginewidgets/simplebrowser/browser.cpp
@@ -23,6 +23,8 @@ BrowserWindow *Browser::createHiddenWindow(bool offTheRecord)
QString::fromLatin1("simplebrowser.%1").arg(qWebEngineChromiumVersion())));
m_profile->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
m_profile->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
+ m_profile->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true);
+ m_profile->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls, false);
QObject::connect(m_profile.get(), &QWebEngineProfile::downloadRequested,
&m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested);
}
diff --git a/src/core/doc/src/qtwebengine-features.qdoc b/src/core/doc/src/qtwebengine-features.qdoc
index dc38f5069..3b74a4dd6 100644
--- a/src/core/doc/src/qtwebengine-features.qdoc
+++ b/src/core/doc/src/qtwebengine-features.qdoc
@@ -31,6 +31,7 @@
\li \l{webrtc_feature}{WebRTC}
\li \l{Web Notifications}
\li \l{Favicon Handling}
+ \li \l{HTML5 WebSockets}
\endlist
\section1 Audio and Video Codecs
@@ -619,4 +620,19 @@
to be stored in the database.
\note The icon database is not available for off-the-record profiles.
+
+ \section1 HTML5 WebSockets
+
+ \QWE supports the WebSocket JavaScript API to communicate with WebSocket servers
+ using the \c {ws://} or \c {wss://} protocols. Moreover, integration with Qt WebChannel
+ and Qt WebSockets enables communication between JavaScript and the native side of
+ the application.
+
+ The Qt WebChannel module has a great example for a
+ \l[QtWebChannel]{Qt WebChannel ChatServer Example}{chat server}
+ and its web based
+ \l[QtWebChannel]{Qt WebChannel ChatClient HTML Example}{chat client}.
+ The client works out of the box in the example browsers of \QWE
+ (such as \l{WebEngine Widgets Simple Browser Example}
+ {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}).
*/