Save Cookies in Qt6.2.4 ?
-
Did you check whether the path has been updated correctly ?
As for QStandardPaths, you likely want the writable path for AppDataLocation.
-
I do this :
QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies); QWebEngineProfile* defaultProfile = QWebEngineProfile::defaultProfile(); defaultProfile->setHttpCacheType(QWebEngineProfile::DiskHttpCache); defaultProfile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies); QHttpPart* header = new QHttpPart; header->setRawHeader("X-Frame-Options", "ALLOWALL"); defaultProfile->setCachePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); defaultProfile->setPersistentStoragePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
but that don't resolve the problem
-
Did you do the paths checks I suggested ?
-
qDebug(qPrintable(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))); qDebug("\n"); qDebug(qPrintable(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)));
return :
C:/Users/paulw/AppData/Local/Paul_WOISARD/FranceTV/cache C:/Users/paulw/AppData/Local/Paul_WOISARD/FranceTV
but the folders don't exist in my system
-
I meant before and after setting the path on the default profile.
-
That I understood very well. Hence I suggested that you compare the values of the cache path before and after you set it on the profile in order to eliminate that as an obvious possible bug.
-
@SGaist said in Save Cookies in Qt6.2.4 ?:
That I understood very well. Hence I suggested that you compare the values of the cache path before and after you set it on the profile in order to eliminate that as an obvious possible bug.
in doc i found this :
QNetworkAccessManager *manager = new QNetworkAccessManager(this); QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); diskCache->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); manager->setCache(diskCache);
which save cache but no cookies
for your question
qDebug("before"); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->persistentStoragePath())); ... ... ... qDebug("after"); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->persistentStoragePath()));
result :
before qt.webenginecontext: ... ... ... after C:/Users/paulw/AppData/Local/Paul_WOISARD/FranceTV
-
@Paullux said in Save Cookies in Qt6.2.4 ?:
qDebug("before"); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->persistentStoragePath()));
the responses to your question is here :
qDebug("before"); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->cachePath())); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->persistentStoragePath())); defaultProfile->setCachePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); defaultProfile->setPersistentStoragePath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); qDebug("after"); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->cachePath())); qDebug(qPrintable(QWebEngineProfile::defaultProfile()->persistentStoragePath()));
reponse :
before C:/Users/paulw/AppData/Roaming/Paul_WOISARD/FranceTV/QtWebEngine/OffTheRecord after C:/Users/paulw/AppData/Local/Paul_WOISARD/FranceTV
cachePath is never set
-
Looks like you found the culprit.
Can you check with 6.3 ?
-
@SGaist said in Save Cookies in Qt6.2.4 ?:
Looks like you found the culprit.
with qt6.2.3 it's the same
CachePath: "" StoragePath: "C:/Users/paulw/AppData/Roaming/Paul_WOISARD/FranceTV/QtWebEngine/OffTheRecord" isOffTheRecord: true after CachePath: "" StoragePath: "C:/Users/paulw/AppData/Local/Paul_WOISARD/FranceTV" isOffTheRecord: true
perhaps cache size must be define
-
Then you should check the bug report system to see if there already something about it. If not, please open a new report providing a minimal compilable example that shows that behaviour.
-
i created a ticket issue : https://bugreports.qt.io/browse/QTBUG-102133
-
its not mean be a bug.
a developer of Qt said me :
Michal Klocek a ajouté un commentaire - Il y a 2 heures
in 6.x series default profile is off the record , you need to create a custom profile and use that.how to create a profile which is on the record ?
-
Unless I am mistaken you got an answer to that as well on the report.
-
The Solution is :
QWebEngineProfile *profile = new QWebEngineProfile(QString::fromLatin1("MyApplication.%1").arg(qWebEngineChromiumVersion())); // unique profile store per qtwbengine version QWebEnginePage *page = new QWebEnginePage(profile); // page using profile QWebEngineView *view = new QWebEngineView(); view->setPage(page); view->setUrl(AccueilUrl); view->setZoomFactor(1.2); setCentralWidget(view);