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

Some Websites not load in QWebViewEngine QT 5.12.0



  • Hello,

    Iam using QT 5.12.0 with Visual Studio 2017 32 bit, I want to view the WhatsApp website which is here, inside the QT webview engine, but I got this message,

    WhatsApp works with Google Chrome 36+
    To use WhatsApp, update Chrome or use Mozilla Firefox, Safari, Microsoft Edge orOpera.
    UPDATE GOOGLE CHROME
    

    so is there any solution to make this work? such as updating the current chromium or any other solution?

    Thanks in advance.


  • Qt Champions 2019

    Looks like you're looking for QWebEngineProfile::setHttpUserAgent



  • can you give me an example of how to use it? I already checked my current User Agent and it's

    "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.0 Chrome/69.0.3497.128 Safari/537.36"
    

    what should i set it to? I found a website here have some user Agent which one should I use to work?
    also I tried to use it in this way i don't no if it's correct and will active user agent on all the pages or not

    in the constructor of the main window i do this

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        QWebEnginePage *page = ui->widget->page();
        qDebug() << page->profile()->httpUserAgent();
    page->profile()->sethttpuserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36");
        connect(ui->widget, SIGNAL(loadProgress(int)), this, SLOT(LoadProgress(int)));
    }
    


  • @Christian-Ehrlicher Thank you it worked :D i tried the above code and it worked already with me, with the current User Agent I added, I have a small problem it worked with me once and now it not work anymore when I run it again!, strange problem? please, any help with this?, i did not change anything the same code, but not working on the second run



  • This post is deleted!

Log in to reply