summaryrefslogtreecommitdiffstats
path: root/examples
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 /examples
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)
Diffstat (limited to 'examples')
-rw-r--r--examples/webenginequick/quicknanobrowser/BrowserWindow.qml2
-rw-r--r--examples/webenginewidgets/simplebrowser/browser.cpp2
2 files changed, 4 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);
}