mail us  |  mail this page

contact us
training  | 
tech stuff  | 

Changing Browser User Agent Strings

claudebot

OK, we admit it. The above is a cheap one line trick using apache SSIs.

We produced this page not because we think changing browser User Agent strings is a good idea - in fact we think it is an incredibly bad idea unless you absolutely need to do it (some sites do not display well, or even at all, if they fail to recognize your browser). But we got mail recently saying someone was having a problem viewing our pages. Turns out it was a badly configured - not deliberately cloaked - UA string. So we got to thinking how could we help fix the problem - and as usual we had no idea! We use server-side browser sniffing to serve browser specific page content - mostly 'cos we want to progressively phase out - or a least minimise - development for non-W3C conformant browsers while pushing ahead with conformant browsers (truth be told we used to feel very strongly about this until the great HTML5 betrayal. Now - meh). Depending on which browser you use you will see a different ZyTrax site - well at least as far as navigation is concerned. 'Nuff said.

So here, for Opera, Moz and the clones, which unless identified specifically includes Firefox, K-Meleon (great stuff), Galeon, Epiphany etc., etc. and, of course, MSIE and Chrome is some info about changing UA strings.

Fall 2015 Update With the exceptions of MSIE and Chrome (limited, primarily for mobile oriented emulation) none of the main browser families provide a native method of User Agent (a.k.a. browser string) changing. This is in contrast to past experiences where the the functionality was part of the basic browser (Chrome, Opera) or provided a workaround (Firefox). Opera, Chrome and Firefox all provide one or more add-ons or extensions in their on-line libraries to enable this feature. All the tested Add-ons/Extensions provided both canned and custom string capabilities. One can only speculate that this third party trend will continue as the browser families seek to provide a secure and robust in their core products.

Opera

Opera 32 (Fall 2015)

The new Opera (WebKit based) identifies itself as WebKit, Chrome and Safari and an Opera specific OPR/version string. In short, as almost everything known to mankind. The only way to change the string now appears to be using an Opera User-Agent Switcher Extension (menu - top left of page in Opera Logo - select Extensions then search extension site for User-Agent. Once installed (which, unlike Firefox does not need a restart) this extension places a button on the top left of the screen (or it can be invoked by right clicking on any empty part of the currently displayed web page). Clicking the UA Switcher button will display a canned list of UAs. Clicking the Options button will allow manual entry of any string which can then be saved under a suitable name and added to the canned list.

Opera 11

Opera has moved to a Webkit (Safari/Chrome) base. Things will change.

In Opera 11 you have to make a Panel visible by clicking the < button at the bottom left of the browser window. Then click the + symbol from the Panel and choose 'Customize...'. In the window that opens select the 'Button' tab then 'Preferences' and drag the 'Identify as Opera' combo box onto the top browser bar. It provides three options: Identify as Opera; Identify as Firefox; Identify as Internet Explorer.

Opera 9

Opera 9 Removed browser change from the Quick Preferences menu - instead use Tools->Quick Preferences->Edit Site Preferences->Select Network Tab->Use Browser Identification combo box.

Opera 7 and 8

Opera 7+ provides a feature to change the UA string from the menu:

Use Tools->Quick Preference and select the browser you want to emulate from the radio button list at the foot of the menu. Or if you like lots of clicking use Tools->Preferences->network then select from the drop down menu under 'Browser Identification'.

Opera 9 Removed browser change from Quick Preferences menu - instead use Tools->Quick Preferences->Edit Site Preferences->Select Network Tab->Use Browser Identification combo box.

Notes:

  1. Opera 7 & 8 default to MSIE identification - which means on our site you will not get our great css menus unless you change to a Moz string - and they have worked perfectly since Opera 7.54. Opera 9 defaults to Opera identification.

  2. Even if you select MSIE (and we assume Mozilla) you get a Opera x.yy string at the end - which some sites object to - not us we just ignore it, actually we ignore most things. You can remove even this vestigial (wow!) string in Opera 8 but not Opera 7. Opera call this cloaked mode. Cloaked mode can only be configured by using the ua.ini file discussed below and it can even be set on a site-by-site basis.

  3. From Opera 8 there is a nifty file called ua.ini (in the same directory as your Opera profile - typically %SystemRoot%\accountname\Application Data\Opera\Opera\profile\ua.ini) in which you can specify any string, including a cloaked string, for either Mozilla or MSIE on a site by site basis (Opera info on this topic - under miscellaneous). Note: if you set a value in the ua.ini file it trumps the menu setting to change identifier. Clicking the menu setting until your fingers bleed will have no effect - the value from the ua.ini will always be used depending on what values you set. The default values in this file are clearly set based on reported site problems. Annotated ua.ini file.

  4. Finally with Opera 8 there is also a snazzy feature to allow you to play with Javascript variables so you can pretend to be a real MSIE browser to client side browser detection routines (Opera info on this topic).

Microsoft Internet Explorer

MSIE 11 (Fall 2015)

Just to keep us all on our toes, MSIE 11 does it the same way as MSIE 8, 9 and 10 (F12 key or gear (top right)->Developer Tools) but then hides the user agent changer under the Emulation tab (it's the third item down on left). Select from a canned list or use Custon to set your own string. Global change, affects all web access on all sites until changed back.

MSIE 8, 9 and 10

The change UA features provided by these versions are extremely flexible and safe to use. To invoke the feature press the F12 key in any page (or click the '*' (gear wheel like) button on the top extreme right and select 'F12 Developer Tools'). From the resulting window click the Tools menu, select 'Change user agent string' and select a canned string from those provided (various MSIE versions, FF, Chrome, Opera and Bing) or select 'Custom..' which allows you to define any string that will subsequently be added to the available menu. A very comprehensive feature set and relatively easy to use. MSIE 10 adds a further Menu Item labeled 'Browser Mode: IE10' which provides a subset of options for local processing only.

MSIE 7

Unknown.

MSIE 6

The basic UA string cannot be changed. Any additional values displayed in the MSIE UA string are defined in the registry. Use Start->Run enter regedit then navigate to the following key:

HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\
    Internet Settings\User Agent

Adding new strings here will cause the name of the field - not the data content to be appended to the UA string. The basic string is left intact.

To change the basic string add (if not present) the following key:

HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\
    Internet Settings\5.0\User Agent
                          (default) "Mozilla/4.0"
                          Compatible "compatible"
                          Version "MSIE 6.0"
                          Platform "Windows NT 4.0"

The default value will replace the Mozilla/4.0 string that MSIE uses. You can add Compatible, Version and Platform strings as shown above and described in this MSDN article. The article also explains how to add Post Platform and Pre Platform values.

Warning: Messing around with the registry can seriously damage your system and your mental health. Do not do do it unless you know exactly what you are doing. Then think twice.

Moz Family

Firefox 41 (Fall 2015)

There is currently no way to change the browser string, that we could find, in a stock Firefox browser. Further, at some point (looks like around FF34/35) the about:config general.useragent.override was disabled with performance being the cited reason. The method using about:config, documented below, no longer works (the pref.js and all other historic, manually editable, config files no longer exist). Instead, there are a number of Add-ons in the Firefox webstore which provide functionality to switch the user agent, and which, from a brief review of the source code of User-Agent Switcher, appear to use shadow copies of variables whose real values used to appear in about:config. (It is probably overstating it to say that current versions of FF preserve about:config as an historical artifact rather than an operational interface.) The tested User-Agent Switcher is invoked from the 'tools' menu and operates globally across all tabs. It provides a limited set of canned values but the user is able to set any number of custom values which are added to the canned set (additionally the user's strings may be imported from XML files). One of the more astonishing aspects is that the User-Agent Switcher Add-On installation required (unlike the Webkit derivatives, Opera and Chrome) a restart of FF.

You can get a user agent switcher extension (alternative site) or do it the hard way (only in pre FF34/35'ish) as shown below.

Firefox Pre 34/35'ish

Enter about:config in the address line and it will display a full list of the variables used. In the filter line type useragent - and if you are lucky there will be a string identified with general.useragent.override - to modify just double click the entry and make your required changes. A number of readers have noted that a change made this way is not saved permanently. Manual editing is the only way to go.

Further, in a standard Firefox install this variable is not present so you will have to add it to the Prefs.js file in your profile directory.

user_pref("general.useragent.override","Some string");

Notes:

  1. With some helpful hints from John Dobson - thanks.
  2. Close Firefox before editing the Prefs.js file.
  3. Make a copy of the Prefs.js file (in case anything goes wrong you can restore the original) - preferably before you edit it.
  4. Some information says use user_pref and others just pref in the Prefs.js file - it does not seem to matter except the entry will be bolded and marked user set in about:config if you use user_pref.
  5. This change is permanent - to change it back to the default remove the line in Prefs.js, or use about:config and double click the entry to change it to something else.
  6. Typical browser strings can be found in the main page under the relevant browser - just cut and paste
  7. If you define an MSIE string such as Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0) and you have the Java Plugin installed (use about:plugins to verify) the most likely result is that your browser will crash on loading with a message telling you to use the MS Java run time. To fix this problem before you modify the Prefs.js file use Tools->Options->Web Features and disable (uncheck) enable Java. Close Firefox, add the above line then reload Firefox. If you have read this note after your browser has crashed - remove the useragent entry from Prefs.js , load Firefox, disable Java, close Firefox, add the line in Prefs.js, then reload Firefox. All will be well - unless you want to use Java that is!

Chrome

Chrome 45 (Fall 2015)

There is a fairly rudimentary UA change feature in the stock chrome installation invoked using Menu (top right corner) More Tools->Developer Tools then click the telephone icon (top right in the Developer tool bar) which seems to be primarily aimed at mobile testing and emulation. There are a number (3 in fall 2015) of extensions in the chrome webstore which provide User-Agent switching features. The one we selected happened to be the same one, with the same button interface, we selected in Opera. (Perhaps not too surprising since both are Webkit based browsers.) The installed extension worked (without the need for an application restart - like Opera but unlike Firefox) and provided the same level of functionality.

Chrome 26

Chrome (as of version 26) provides an updated sneaky (in the sense that it is well hidden) and broken (does not work) method to change the UA. Click the Customize and Control icon (now 3 lines - good to see google constantly improving their UI to make it more intuitive) in the top right of the main window and select Tools-> Developer Tools from the menus. This opens a split screen at the bottom of the page. Click the settings icon (a gear icon on the extreme bottom right - just to keep you guessing), click Overrides on left hand menu, then check User Agent and select your favorite (should that be least objectionable) browser ID string from the combo box. And all of this has no effect - it does not work. It is broken, non-functional, ineffective and does nothing. It could even be called a bug (it also creates some very strange string based on the combo box selection but this could be a further reflection of its brokeness).

Chrome 17

Chrome (as of version 17) provides a sneaky (in the sense that it is well hidden) method to change the UA. Click the Customize and Control icon (a spanner) in the top right of the main window and select Tools-> Developer Tools from the menus. This opens a split screen at the bottom of the page. Click the settings icon (a gear icon on the extreme bottom right - just to keep you guessing), check Override User Agent and select your favorite (should that be least objectionable) browser ID string from the combo box.

Chrome 11

Bizarrely, Chrome (as of version 11) does not offer any easy way to modify its UA string. Instead you have to use a command line switch of the form "--user-agent="replacement string". Equally bizarrely, on Windows Chrome's executable (chrome.exe) does not reside in the normal Program Files or Program Files (x86) directories instead it resides in Users\username\AppData\Local\Google\Chrome\Application (Vista and Windows 7) and which apparently translates to Documents and Settings\username\Local Settings\Application Data\Google\Chrome in XP. You either need to open a command prompt window, navigate to the above location and then enter chome.exe --user-agent="string" (life is too short to do that twice) or create a shortcut to chrome.exe in the above directory and edit the short cut (right click, select properties) and add the appropriate --user-agent="string", then rename the shorcut to reflect the browser string and drag it onto your desktop or some equally appropriate place. Repeat as often as needed to cover your favorite alternative strings.



Problems, comments, suggestions, corrections (including broken links) or something to add? Please take the time from a busy life to 'mail us' (at top of screen), the webmaster (below) or info-support at zytrax. You will have a warm inner glow for the rest of the day.

Tech Stuff

RSS Feed Icon

If you are happy it's OK - but your browser is giving a less than optimal experience on our site. You could, at no charge, upgrade to a W3C standards compliant browser such as Firefox

Search

web zytrax.com

Share

Icons made by Icomoon from www.flaticon.com is licensed by CC 3.0 BY
share page via facebook tweet this page

Page

email us Send to a friend feature print this page Display full width page Decrease font size Increase font size

Mobile Stuff

mobile things
Android
AvantGo
Blazer
Bolt
DoCoMo
Dolphin
EudoraWeb
ftxBrowser
Minimo
NetFront
PIE
OpenWave
Obigo/Q7
PocketLink
PalmSource
Plucker
Xiino
Tear
UCWEB
Telephones/PDAs
Others

Vendors

Android aThingies
Apple iThingies
Blackberry
Google Nexus
HTC
Kindle
Lenovo
LGE
Motorola
Micromax
Nokia
OnePlus
Samsung
Windows Phone 7
ZTE

Browsers

1X
Acorn Browse
Act 10
Amaya
AmigaVoyager
Android
APT-GET
Arachne
Arora
Avant Browser
AvantGo
Aweb (Amiga)
Bluefish
Brave
Browsex
Camino
Charon
Check&Get
Chimera
Chrome (Google)
ChromePlus
Chromium (Google)
Conkeror
Comodo Dragon
Contiki
Curl
Democracy
Dillo
DocZilla
edbrowse
Elinks (text)
Emacs
Enigma
Epiphany
fetch
Firefox
Flock
Galeon
Gnuzilla
Google
GreenBrowser
HotJava
HTTPClient
Hv3
IBrowse
iCab
ICE (Borland)
IceWeasel/IceCat
IPD (AlertSite)
Iron
Kazehakase
Kkman
K-Meleon
Konqueror
Links (text)
Lobo
Lynx (text)
Maxthon
midori
Min
Mosaic
Mothra
Mozilla
MS Explorer
MSIE Clones
muCommander
NetPositive
Netscape
Netsurf
OffByOne
OmniWeb
One Laptop per Child
Opera (+Mini)
Oregano
Oxygen
Palemoon
PalmSource
Phoenix
PrintSmart (HP)
Prism (Mozilla)
Proxomitron
retawq
Safari
Secure Web Browser
Shiira
SiS (Apple)
Sleipnir
SlimBrowser
Smartbro
Spicebird
Songbird
SRWare Iron
Stainless
Strata
Surf
SwiftFox
Sylera
Vision
Vivaldi
w3CLineMode (text)
w3m (text)
Waterfox
WebCapture (Adobe)
WebOSbrowser
WebPositive
WebTV (MS)
Wget
Xenu
Xiino Xmaxima Yandex

Sections

BHOs
W3C strings
unpleasant things
mystery strings
change ua's
in the wild

Browser Stats

Upsdell
w3schools

Browser Info

Mozilla UA Strings
evolt browser archive

Site

CSS Technology SPF Record Conformant Domain
Copyright © 1994 - 2024 ZyTrax, Inc.
All rights reserved. Legal and Privacy
site by zytrax
hosted by javapipe.com
web-master at zytrax
Page modified: January 20 2022.