Is it possible to access the QNetworkCookieJar
in QtWebEngine
like you could before with QtWebKit
? I can't find it anywhere in the documentation...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
From Qt 5.6 onwards you can use the QWebEngineCookieStore class.
回答2:
QNetworkCookie is available for QtWebEngine, but only through the old QNetworkAccessManager
as QtWebEngine
is using its own HTTP implementation. You can notice this while reading one of the examples:
contains(DEFINES, QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) {
HEADERS += cookiejar.h networkaccessmanager.h
SOURCES += cookiejar.cpp networkaccessmanager.cpp
}
Please refer to the following example for details:
WebEngine Tab Browser Example