QtWebEngine & HTML5 Application Cache
-
Dear Qt community,
We started with QT a few weeks ago to create an application that's mainly based on a webview. At first I developed it with the webview / webkit and QML until I discoverd the much better engine QtWebEngine. The last days we are trying to find a way to get localStorage working with this one, without success.
Everything works (video plays, html page loads) but when I disable my internet connection and refresh, I get the default Chromium error (no internet connection). The same code with WebKit is working perfectly, also I'm missing the option to set the setOfflineWebApplicationCachePath, wich was very handy with QtWebView.
I'm wondering if anyone has experienced the same problem.
Thank you,
Willem@
#include <QApplication>
#include <QMainWindow>
#include <QDir>
#include <QString>
#include <QStandardPaths>
#include <QWebEngineView>
#include <QWebEngineSettings>int main(int argc, char *argv[])
{
QApplication app(argc, argv);QWebEngineView *webview = new QWebEngineView(); QWebEngineSettings *defaultSettings = webview->settings(); defaultSettings->setAttribute(QWebEngineSettings::LocalStorageEnabled, true); //defaultSettings->setAttribute(QWebSettings::PluginsEnabled,true); //defaultSettings->setOfflineWebApplicationCachePath(QDir::homePath()+"/xscreen"); //defaultSettings->enablePersistentStorage(QDir::homePath()+"/xscreen"); //defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); webview->load(QUrl("http://www.epicbrands.be/xscreen/cache")); QMainWindow *window = new QMainWindow(); window->setCentralWidget(webview); window->show(); return app.exec();
}
@