Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange User Agent With Google Chrome

I was working with some javascript and found a strange user agent with my Google Chrome.

I have Google Chrome 7.0.517.41 beta installed on my Ubuntu Laptop. Now AFAIK my user agent should be something close to Chrome/7.0.517.41

but it is showing me:

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7 

Why is this happening.. I have disabled all the installed extensions but it is still the same..

like image 554
Shiv Deepak Avatar asked Oct 26 '10 13:10

Shiv Deepak


People also ask

Can user agent be spoofed?

In user-agent spoofing, bad actors modify elements of the user agent string to obfuscate details of their traffic. For example, making high traffic volumes from a single device look like lots of individual advertising engagements from multiple devices.

How many user agents are there?

Browse our database of 219.4 million User Agents - WhatIsMyBrowser.com.


2 Answers

The UA string tells the long and tragic history of (in)compatibility attempts. See e.g. this for a brief history of the UA. It should also make clear that UA sniffing is useless, as every modern browser pretends to be many other browsers. That is also the case you see here:

  • Mozilla - the most ancient artefact, dating from the early 1990s
  • X11 - the graphical interface used
  • Linux i686 - OS and processor type
  • en_US - your locale (English, United States)
  • AppleWebKit/534.7 - the actual rendering engine
  • (KHTML, like Gecko) - another artifact of browser sniffing: "Gecko" is the FF rendering engine, KHTML is an old rendering engine, predecessor of WebKit (was used by Konqueror browser, then forked by Apple to form WebKit)
  • Chrome/7.0.517.41 - the actual browser version
  • Safari/537 - yet another artifact against scripts sniffing for "Safari" (which uses the same engine)

In short: some broken sites assumed that "only allowing people with Mozilla/Firefox/Webkit/whatever" is a sensible policy; in turn, browsers started lying about their origins to get around these artificial barriers. The UA strings are the result: bloatware, full of useless garbage.

like image 75
3 revs, 3 users 93% Avatar answered Sep 21 '22 00:09

3 revs, 3 users 93%


Basically, Mozilla stands for "Mozilla compatible" while "KHTML, like Gecko" describes the rendering engine.

Essentially, Chrome's user agent string is saying "I'm compatible with Mozilla and my rendering engine is like Gecko" as a way of describing itself to developers.

Most (if not every) browser will identify itself as Mozilla-compatible as a kind of legacy thing, regardless of affiliation with the Mozilla foundation. Yes, even Internet Explorer.

More info on strings in general at: Mozilla's developer center.

Also, if you're developing based on user agent strings, don't. You'll only find yourself in a world of hurt: browsers get upgraded to implement features and your user agent sniff might still exclude them, user agent strings can be spoofed, and good old Opera likes to report itself as Internet Explorer in older versions.

Instead, use feature detection to determine if a feature you're trying to use exists for a given browser and then use it or don't.

like image 35
ajm Avatar answered Sep 24 '22 00:09

ajm