QtWebEngine cannot save cache
-
Hello,
When I used Qt6.2.0 with my windows program that uses QtWebEngine, the cache and cookies were not saved.I tried running
Qt/Examples/Qt-6.2.0/webenginewidgets/cookiebrowser
with Qt5.15.2 and Qt6.2.0, and it seems that cookies are saved with Qt5, but not with Qt6.
I addedQWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
, but it didn't work.
How can I enable cache saving in Qt6? -
Resolved.
https://doc-snapshots.qt.io/qt6-dev/qtwebengine-changes-qt6.htmlDefault Profile
The default profile is now off the record.
To have a standard browser profile with disk-cache and cookies, we recommend creating your own profile and using that explicitly.So, I used
m_webview->setPage(new QWebEnginePage(new QWebEngineProfile("MyProfile")));
instead ofQWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
, and it worked. -
Hey, I wanted to check-in on this item; I know it was resolved back in 2021 for this case, but since updating to QT 6.8, even with creating a profile and setting the cache/cookie to save to disk, it doesn't seem to "remember" when logging out and back into KDE. Any insight, or maybe point me in the right direction, would greatly be appreciated.
-
Hi @Kevin_Burns, did you ever work out what your problem was? I am on QT 6.8, am pretty sure I have done everything the documents say to do, but cannot get the cache and cookies to persist.
Thanks