Skip to content

Truly independent web browser

LibWebCommon: Lay out the User-Agent string the way Chrome does

sideshowbarker8df0e61b479f
diff --git a/Libraries/LibWebCommon/Loader/UserAgent.h b/Libraries/LibWebCommon/Loader/UserAgent.h
index eb9ee082370..fc2dc719b25 100644
--- a/Libraries/LibWebCommon/Loader/UserAgent.h
+++ b/Libraries/LibWebCommon/Loader/UserAgent.h
@@ -67,7 +67,7 @@ namespace Web {
// NB: Some web servers treat us very badly unless we pretend to be one of the major browsers.
// This token is appended to the User-Agent string to improve compatibility.
// We will need to update this periodically to match a somewhat recent version.
-#define SAD_COMPATIBILITY_HACK "Chrome/153.0.0.0 AppleWebKit/537.36 Safari/537.36"
+#define SAD_COMPATIBILITY_HACK "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36"
// NB: Servers sniff the parenthesized platform token of the User-Agent string and only recognize
// the frozen tokens sent by major browsers. Reporting the actual OS and CPU here gets us
diff --git a/Tests/LibWeb/Text/input/Fetch/user-agent-client-hints.html b/Tests/LibWeb/Text/input/Fetch/user-agent-client-hints.html
index 2814440d7a0..7474e2a89db 100644
--- a/Tests/LibWeb/Text/input/Fetch/user-agent-client-hints.html
+++ b/Tests/LibWeb/Text/input/Fetch/user-agent-client-hints.html
@@ -23,7 +23,7 @@
}
const chromeUA = name =>
- `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ${name}Chrome/153.0.0.0 AppleWebKit/537.36 Safari/537.36`;
+ `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ${name}AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36`;
try {
const own = await hintsFor(null);