Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to read HTML document cookie?
Forum Updated to NodeBB v4.3 + New Features

How to read HTML document cookie?

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 277 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Debjit
    wrote on last edited by Debjit
    #1

    Hi ,its my second post for the day,here is what I am trying to do
    I am accessing a webpage using POST method (using QNetworkAccessManager) ,now in response the html source have a javascript which sets the documents cookie ,I want to extract this cookie here ishow the html looks

    <html>     
    <script type="text/javascript">
                    document.cookie="this is the data i want to extract"
    </script>
    </html>
    

    Do anyone knows a good way to do this in QT like parsing the DOM

    Thanks

    EDIT (17 dec 2018)

    For future if somebody have a similar problem that they don't want to execute the javascript or run any web engine to parse the html content here is how I did..

    1)Use QTextStream and load the html containt into it.
    2)Read each line and conditionally check
    3) if the line contains the string "document.cookie=" using QString::contains() function
    4) when found replace the string and the ending part i.e.. ";" using QString::replace() function

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved