Set cookie before loading url WebEngineView(qml)

  • Hi,
    How can I set cookie before loading a url on WebEngineView that is created in qml code, can I inherit from something like WebEngineViewItem to create my customized WebEngineView?
    the WebEngineView widget has a page() method that return page and then I can get profile and then the cookieStore but I didn't find any way for qml code.

  • Seems this is OK,

    QQuickWebEngineProfile* defaultProfile = QQuickWebEngineProfile::defaultProfile();
    QWebEngineCookieStore *cookieStore = defaultProfile->cookieStore();
    QNetworkCookie cookie;

    You can also pass the profile property of the WebEngineView from Qml to C++ and do same.
    There is no page method for Qml WebEngineView.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.