Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. WebEngineProfile useragent strange behavior
Forum Updated to NodeBB v4.3 + New Features

WebEngineProfile useragent strange behavior

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 407 Views 2 Watching
  • 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.
  • T Offline
    T Offline
    tubbadu
    wrote on last edited by tubbadu
    #1

    Hello there! I'm trying to run Whatsapp web in a WebEngineView (as a plasmoid), so I changed the useragent:

    WebEngineView {
    	id: webview
    	anchors.fill: parent
    	url: "https://web.whatsapp.com" 
    
    	profile: WebEngineProfile{ 
    			httpUserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36" //Chrome user agent
    		}
    	}
    	Button{
    		id: reload
    		text: "reload"
    		onClicked: {
    			webview.reload()
    		}
    	}
    

    so when I run the plasmoid it correctly shows whatsapp login QR code, I can login and start messaging without a flaw
    but whenever I refresh the page clicking the refresh button, it says "whatsapp works with chrome 60+, update your browser"

    why is this happening? The user agent is still the same because if I go to a site like this it says my useragent is the one I set in httpUserAgent even after reloading

    any idea?

    EDIT: even if I build a normal QT quick application (not as a Plasmoid) this happens, so it's not a plasmoid problem

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What if you set just chrome as user agent ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What if you set just chrome as user agent ?

        T Offline
        T Offline
        tubbadu
        wrote on last edited by
        #3

        @SGaist do you mean to just set

        httpUserAgent: "Chrome"
        

        ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's a bit too short I think. The serial number is missing.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          T 1 Reply Last reply
          0
          • SGaistS SGaist

            That's a bit too short I think. The serial number is missing.

            T Offline
            T Offline
            tubbadu
            wrote on last edited by
            #5

            @SGaist I tried with Chrome/103.0.0.0 but I think it does not recognize it, it says immediately to use another browser
            that string I put in the first example is my default browser user agent string and on that browser it works fine

            It's really strange that it works just until I reload the page, I don't know what could it cause this problem

            T 1 Reply Last reply
            0
            • T tubbadu

              @SGaist I tried with Chrome/103.0.0.0 but I think it does not recognize it, it says immediately to use another browser
              that string I put in the first example is my default browser user agent string and on that browser it works fine

              It's really strange that it works just until I reload the page, I don't know what could it cause this problem

              T Offline
              T Offline
              tubbadu
              wrote on last edited by
              #6

              don't know why, but if instead of reload() I use reloadAndBypassCache() it works, it's really strange

              now the problem is that it doesn't keep me logged in, I think it doesn't save any cookies

              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