[webkit-gtk] Setting global user agent

Simon Schampijer simon at schampijer.de
Mon Jan 16 03:42:00 PST 2012


Hi,

I would like to globally append a custom identifier to the user agent. 
Following the documentation I am using WebKitWebSettings [1] to do so, 
something like this in Python:

 >>> from gi.repository import WebKit
 >>> web_view = WebKit.WebView()
 >>> web_settings = web_view.get_settings()
 >>> web_settings.props.user_agent += ' Sugar Labs/0.96'
 >>> web_view.set_settings(web_settings)

However this needs to happen with every new WebView I create (several in 
a multi-tab session). Is there a way to edit the user agent globally?

I grepped in the Epiphany code and they have a customization to set the 
user agent (this is unset by default) and still they have something like 
'Epiphany/3.2.1' appended to their user agent. I could not find out 
where they do it so far and I am wondering if there is another option 
then the above and if I am missing something.

Regards,
    Simon

[1] http://webkitgtk.org/reference/WebKitWebSettings.html


More information about the webkit-gtk mailing list