Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Get/Set cookies from qml



  • Hi all:
    I am writting a client program. When I login, the server will send some cookies to me in the 'Set-Cookie' header field. I need to get the cookies, because the rest of the request will need them.

    I try to get the cookies with xmlhttprequest.getResponseHeader("Set-Cookie"), but failed. I don't want to use C++, so could it be possible?



  • That's impossible from QML. There is code in quite low level that basically prevents cookies. That code is done because of security issues but is completely irrelevant to QML.



  • QML is not a browser, it doesn't have any cookies.



  • imihajlov, what if I want to write browser using QML?



  • If you want to write a browser you should make some low-level c++ components that make cookies and everything available from QML :)



  • Exactly. While there is no reason why that shouldn't be possible using pure QML.

    P.S. Maybe that's possible using webkit but that's different topic.


Log in to reply