I created my own Webbrowser with QtWebEngine. Now I would like to set the User Agent with this->page()->profile()->setHttpUserAgent(USER_AGENT);
. This works well for the main view.
If i create a new myWebEngineView
inside the methode createWindow
of myWebEngineView
the User Agent will be the default User Agent of QtWebEngine.
myWebEngineView
is a subclass of QWebEngineView
.
How can I set the User Agent for all views?
You can set the user agent in the newly created window again:
The user agent needs to be set twice, else its not transferred to the pages, see also ProfileAdapter::setHttpUserAgent(const QString &userAgent).