[Qtwebengine] How to change user agent?

Fabian Bernhard fbernhard at gmail.com
Tue Jan 21 13:41:48 CET 2014

Hi Pierre

I think you'll most likely need something like this for your needs:
> https://codereview.qt-project.org/#change,75125
> It is essentially just missing the permission granting part (which could
> be a bit of a problem if the contents you load are untrusted, you have been
> warned).

Thats fine in my case since I let the QtWebEngine only open exactly one
website which we control ourselves.

> We don't have user agent string overriding implemented yet (shouldn't be
> too hard, we just didn't get around to it), but in that case, WebRTC should
> work everywhere they sniff the UA-string thanks to adding the a mention of
> Chromium and the version we're based off alongside the usual suspects
> (Mozilla, WebKit, KHTML, Gecko and Safari).

Many of the WebRTC websites including ours use Google's adapter.js [0] to
set up the peer connection. With the current user agent this script fails

webrtcDetectedVersion =

Thats the reason I'd like to change the user agent. Would you by any chance
know where in the source the current user agent is defined? I have grep'ed
all .h, .c and .cpp files for AppleWebKit and couldn't find a match...

Thanks and regards,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20140121/91d18a84/attachment.html>

More information about the QtWebEngine mailing list