Uzbl

Tasklist

FS#269 - Allow access to WebKit User Agent major and minor versions

Attached to Project: Uzbl
Opened by Mike Stegeman (mrstegeman) - 2011-06-06 03:52:35 PM
Last edited by Ben Boeckel (mathstuf) - 2013-07-06 12:20:25 AM
Task Type Feature Request
Category uzbl-core
Status Closed
Assigned To Ben Boeckel (mathstuf)
Operating System All
Severity Low
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Some other WebKit-based browsers report their WebKit version differently than Uzbl. This is because WebKit defines user agent major and minor versions that are different from the actual WebKit version. For instance, Chrome reports something like:

"AppleWebKit/534.24 (KHTML, like Gecko)"

The way Uzbl presents its user agent can lead to issues with websites that expect certain versions of WebKit or Gecko. That being the case, Uzbl can easily be changed to present the WebKit user agent version correctly. See the patch below:



diff --git a/README b/README
index 7d874d8..98ef369 100644
--- a/README
+++ b/README
@@ -372,6 +372,8 @@ file).
* `WEBKIT_MAJOR`: WebKit major version number.
* `WEBKIT_MINOR`: WebKit minor version number.
* `WEBKIT_MICRO`: WebKit micro version number.
+* `WEBKIT_UA_MAJOR`: WebKit User Agent major version number.
+* `WEBKIT_UA_MINOR`: WebKit User Agent minor version number.
* `ARCH_UZBL`: Processor architecture for which Uzbl is compiled, set at compile
time.
* `COMMIT`: ID of the current Git commit, set at compile time.
diff --git a/examples/config/config b/examples/config/config
index 4c5f1a0..143de0b 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -137,6 +137,7 @@ set progress.pending =
# === Useragent setup ========================================================

set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname -sm)@ [@ARCH_UZBL])
+set useragent = Uzbl AppleWebKit/@{WEBKIT_UA_MAJOR}.@{WEBKIT_UA_MINOR} (KHTML, like Gecko) (@(+uname -sm)@)

# === Configure cookie blacklist ========================================================

diff --git a/src/callbacks.c b/src/callbacks.c
index bc964cd..52ae54f 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -304,7 +304,7 @@ cmd_html5_local_storage() {

void
cmd_local_storage_database_path() {
- g_object_set (G_OBJECT(view_settings()), "local-storage-database-path",
+ g_object_set (G_OBJECT(view_settings()), "html5-local-storage-database-path",
uzbl.behave.local_storage_database_path, NULL);
}

diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 05754c2..f10bdaf 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -143,6 +143,8 @@ const struct var_name_to_ptr_t {
{ "WEBKIT_MAJOR", PTR_C_INT(uzbl.info.webkit_major, NULL)},
{ "WEBKIT_MINOR", PTR_C_INT(uzbl.info.webkit_minor, NULL)},
{ "WEBKIT_MICRO", PTR_C_INT(uzbl.info.webkit_micro, NULL)},
+ { "WEBKIT_UA_MAJOR", PTR_C_INT(uzbl.info.webkit_ua_major, NULL)},
+ { "WEBKIT_UA_MINOR", PTR_C_INT(uzbl.info.webkit_ua_minor, NULL)},
{ "ARCH_UZBL", PTR_C_STR(uzbl.info.arch, NULL)},
{ "COMMIT", PTR_C_STR(uzbl.info.commit, NULL)},
{ "TITLE", PTR_C_STR(uzbl.gui.main_title, NULL)},
@@ -1722,6 +1724,8 @@ initialize(int argc, char** argv) {
uzbl.info.webkit_major = webkit_major_version();
uzbl.info.webkit_minor = webkit_minor_version();
uzbl.info.webkit_micro = webkit_micro_version();
+ uzbl.info.webkit_ua_major = WEBKIT_USER_AGENT_MAJOR_VERSION;
+ uzbl.info.webkit_ua_minor = WEBKIT_USER_AGENT_MINOR_VERSION;
uzbl.info.arch = ARCH;
uzbl.info.commit = COMMIT;

diff --git a/src/uzbl-core.h b/src/uzbl-core.h
index c607486..0bd8ae8 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -209,6 +209,8 @@ typedef struct {
int webkit_major;
int webkit_minor;
int webkit_micro;
+ int webkit_ua_major;
+ int webkit_ua_minor;
gchar* arch;
gchar* commit;
gchar* pid_str;
This task depends upon

Closed by  Ben Boeckel (mathstuf)
2013-07-06 12:20:25 AM
Reason for closing:  Implemented
Comment by Mike Stegeman (mrstegeman) - 2011-06-06 05:07:09 PM
Oops, disregard the patch for 'callbacks.c'. That's for something else I've been working on.
Comment by Ben Boeckel (mathstuf) - 2013-07-02 05:35:45 AM
These values aren't available in WebKit2; I'll add them for WebKit1 though.
Comment by Ben Boeckel (mathstuf) - 2013-07-06 12:20:16 AM
This is done on dev/cleanup on my fork.

Loading...