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

QWebEngineView issue



  • Hi all,

    With the following code:

    #include <QApplication>
    #include <QWebEngineView>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QWebEngineView w;
        w.setUrl(QUrl("https://web.whatsapp.com/"));
        w.show();
        return a.exec();
    }
    
    

    I get the following response from WhatsApp Web:
    Screenshot_2020-01-11_17-27-57.png

    I'm on Archlinux 64bit with Qt 5.14.

    The doc says "This version of Qt WebEngine is based on Chromium version 77.0.3865, with additional security fixes from newer versions." so there shouldn't be any problem, what's wrong here ?

    Thanks in advance,
    Xavier



  • Answer here: https://bugreports.qt.io/browse/QTBUG-81314

    #include <QApplication>
    #include <QWebEngineView>
    #include <QWebEngineProfile>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QWebEngineView w;
        w.page()->profile()->setHttpUserAgent(w.page()->profile()->httpUserAgent().remove(QRegExp("QtWebEngine\\/\\S{1,} ")));
        w.setUrl(QUrl("https://web.whatsapp.com/"));
        w.show();
        return a.exec();
    }
    

Log in to reply