Spoofing user agent strings with User Agent Switcher

User Agent Switcher is an extension for FireFox, written by Chris Pederick that allows you to switch the user agent string in FireFox. This is handy for Web testing when you need to masquerade as another browser. For example, when testing Intelligent Authentication, in order to cause the secondary authentication to occur I come into the site (which looks at my user agent string) using FireFox 1.5, after I have some FireFox history built up with Intelligent Authentication I then change the user agent string using User Agent Switcher to Opera 5 which causes IA to ask for secondary authentication. Or another example of its use for testing is when browser sniffing code has been put in place and the result of the sniff is that you are redirected to a certain page or message. With User Agent Switcher you can simply change the user agent string to the desired browser and then masquerade as that browser in order to get to the intended page or message. Pretty spiffy eh? No need to install a ton of different browsers just to see one message. Note: when I say “page” I’m not implying that you are testing this page for browser compatibility; FireFox will still render the page.

Within the extension the list of user agent strings can be modified (which is great because there are 100s of user agent strings). You can modify the list three different ways.

  1. Use the extension “Options” section to input an agent manually.

  2. Use the extensions “Options” section to import a list of agents from an XML file.

  3. Modify the Prefs.js file yourself found in your FireFox profile. The directory should look something like: C:\Documents and Settings\UserName\Application Data\Mozilla\Firefox\Profiles\ogrevxiy.default

User Agent Switcher installs with only a few user agents. This didn’t cut it for my testing, so I created this XML file to extend the user agents.

It’s a great FireFox extension that has real value for Web application testing. Give it a try!