There is an addon in firefox known as User Agent Switcher to use the web services as a Google bot, Yahoo Slurp, or as an Iphone/Android user. Can anyone guide me about how does it work in the background. What are the properties/attributes that it modifies to perform this task?
2 Answers
User Agent Switcher sets a bunch of preferences:
general.useragent.appName
general.appname.override
general.appversion.override
general.platform.override
general.useragent.override
general.useragent.vendor
general.useragent.vendorSub
These replace the individual parts of a user agent string - it's as simple as that. Everything else in its code is user interface and selection logic. Actually, I am unsure why this complicated approach was chosen: setting only general.useragent.override
is sufficient, its value will replace the entire user agent string.
You can easily create that preference yourself using about:config
, this article describes the steps in detail.

- 56,865
- 12
- 98
- 126
Let me answer the question in the Wladimir Palant's answer.
In short, UserAgentSwitcher's design seems to follow the past specification of firefox (or browser in general) which is now obsolete.
Now details: According to MDN's page on userAgent, Firefox's useragent is built from the components mentioned by Wladimir, as: userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU; Localization; rv: revision-version-number) product/productSub Application-Name Application-Name-version
.
But as of 2015 Aug, it's wrong; the useragent can only be overriden from general.useragent.override
, as far as I tested, and these elements are ignored.
Nonetheless, Javascript discloses them:
Javascript element Firefox preference
navigator.appCodeName ?
navigator.appName general.appname.override
navigator.appVersion general.appversion.override
navigator.platform general.platform.override
navigator.product ?
navigator.productSub ?
navigator.vendor general.useragent.vendor
navigator.vendorSub general.useragent.vendorSub</code></pre>
MDN's another page says these are now removed from the Web standard, but most browsers still support them. For typical values of major browsers, see for example this site. (This page is in Japanese, but that must be no problem. Feel free to modify.)
Probably readers know that most sites change their behavior by checking the useragent value but it's merely a rule of thumb, not reliable both for web designers and page visitors.

- 1,348
- 1
- 16
- 21