about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-01-07 15:43:39 +0000
committerMarco Peereboom <marco@conformal.com>2011-01-07 15:43:39 +0000
commit0a996f2e0398769c9d79e996c563f9f4d569d34b (patch)
treeb3ab50b9b7903fe8cf2d40ca55393ad36682e07c
parentaff5284326160f11c3b385d13d24621c6ac08ba4 (diff)
downloadxombrero-0a996f2e0398769c9d79e996c563f9f4d569d34b.tar.gz
add user_agent setting
-rw-r--r--xxxterm.14
-rw-r--r--xxxterm.c13
-rw-r--r--xxxterm.conf6
3 files changed, 19 insertions, 4 deletions
diff --git a/xxxterm.1 b/xxxterm.1
index 4f49d1b..8d4615b 100644
--- a/xxxterm.1
+++ b/xxxterm.1
@@ -223,6 +223,10 @@ This file is parsed as a normal configuration file and will override settings
 since it is read at a later time.
 One should only use this file to add js_wl, cookie_wl and mime_type entries.
 This file is machine generated and should not be edited by hand.
+.It user_agent
+Set to override the default
+.Nm
+user-agent string.
 .El
 .Pp
 .Nm
diff --git a/xxxterm.c b/xxxterm.c
index 60559bd..ace4968 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -526,6 +526,7 @@ struct settings {
 	{ "single_instance", XT_S_INT, XT_SF_RESTART , &single_instance, NULL, NULL },
 	{ "ssl_ca_file", XT_S_STR, 0 , NULL, &ssl_ca_file, NULL },
 	{ "ssl_strict_certs", XT_S_INT, 0 , &ssl_strict_certs, NULL, NULL },
+	{ "user_agent", XT_S_STR, 0 , NULL, &user_agent, NULL },
 	{ "window_height", XT_S_INT, 0 , &window_height, NULL, NULL },
 	{ "window_width", XT_S_INT, 0 , &window_width, NULL, NULL },
 
@@ -4978,10 +4979,14 @@ create_browser(struct tab *t)
 	/* set defaults */
 	t->settings = webkit_web_settings_new();
 
-	g_object_get((GObject *)t->settings, "user-agent", &strval,
-	    (char *)NULL);
-	t->user_agent = g_strdup_printf("%s %s+", strval, version);
-	g_free(strval);
+	if (user_agent == NULL) {
+		g_object_get((GObject *)t->settings, "user-agent", &strval,
+		    (char *)NULL);
+		t->user_agent = g_strdup_printf("%s %s+", strval, version);
+		g_free(strval);
+	} else {
+		t->user_agent = g_strdup(user_agent);
+	}
 
 	setup_webkit(t);
 
diff --git a/xxxterm.conf b/xxxterm.conf
index 9f95b07..63013d3 100644
--- a/xxxterm.conf
+++ b/xxxterm.conf
@@ -24,6 +24,12 @@ save_global_history	= 0
 # window_width		= 1024
 # window_height		= 768
 
+# user_agent can bet set to just about anything
+# for a comprehensive list see: http://www.useragentstring.com/pages/All/
+#
+#user_agent		= Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))
+#user_agent		= Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; de-de) AppleWebKit/534.15+ (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
+#user_agent		= Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)
 
 # only useful if enable_scripts = 0
 enable_js_whitelist	= 1