Nominate our 2022 Qt Champions!

[SOLVED] QWebView UserAgent PHP

  • Got a problem with the User Agent QWebView.

    I changed the User Agent like this:

    QString userAgentForUrl ( const QUrl & url ) const;

    #include "mybrowser.h"

    MyBrowser::MyBrowser(QObject *parent) : QWebPage(parent)

    QString MyBrowser::userAgentForUrl ( const QUrl & url ) const

    return "My User Agent";



    MyBrowser *MyBrowserUserAgent = new MyBrowser();



    Works on sites that show the user agent, but does not work with PHP $_SERVER ["HTTP_USER_AGENT"];

    It's return: Mozilla/5.0

    In Javascript is the same way, only return the "My User Agent" when i get the Browser Version, not the browser user agent.

Log in to reply