Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QtWebEngine & HTML5 Application Cache

QtWebEngine & HTML5 Application Cache

Scheduled Pinned Locked Moved QtWebEngine
2 Posts 2 Posters 4.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RoxorStudios
    wrote on last edited by
    #1

    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();
    

    }
    @

    1 Reply Last reply
    0
    • J Offline
      J Offline
      joss405
      wrote on last edited by
      #2

      Hi,

      Now you can use the following line for a QWebEngineView object :

      webview ->page()->profile()->setCachePath("C:/Users/yourUserName/AppCacheFolder");

      See you.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved