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. Weird issue with WebView and Whatsapp web
Forum Updated to NodeBB v4.3 + New Features

Weird issue with WebView and Whatsapp web

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 249 Views 1 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
    #1

    Hello! I'm trying to display the whatsapp web website (web.whatsapp.com) in a webview element, Qt6. To do so, I changed the user agent, like this:

    import QtQuick
    import QtQuick.Controls
    import QtWebEngine
    import QtWebView
    
    ApplicationWindow {
        visible: true
        width: 800
        height: 600
    
        WebView {
            id: webView
            anchors.fill: parent
            httpUserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
    
            onLoadingChanged: {
                deleteAllCookies()
                httpUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
            }
    
            Component.onCompleted: {
                // Load example.com
                webView.url = "https://web.whatsapp.com/";
               // webView.url = "https://www.whatismybrowser.com/";
            }
        }
    }
    

    and then I run it with

    qml6 main.qml
    

    the strange thing is that it works until the page is reloaded. right after being run, it displays the QR code, and you can log in and view and send messages perfectly. But if I right click on the page and hit "reload", it imediately displays the "you must use Chrome 60+" message. I tried loading https://www.whatismybrowser.com/ to show my useragent, and even after reloading it still is the one I set. Why is whatsapp behaving like this? how can I solve this?

    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