Testing for FireFox, Chrome User Agents, using the IE9 Developer Toolbar

IE9 Toolbar’s Browser Mode allows us to test for different versions of IE.  This feature has been there right from IE8 Developer Toolbar.   But, I always thought that the testing was just limited to the different versions of IE i.e. IE7, IE8 and IE9.  One of the advantages of having a technical boss is that, he points to the right set of information when needed.  @harishV pointed out that you can test even for other browsers such as Chrome, Firefox, Safari from within the IE9 Developer Toolbar.

For the purpose the demonstration, I am using  a simple Web Application with a Button and a Label that displays the User Agent when clicked.

Once you add the Button and Label, the button click event has the following code (simple stuff, but just putting it for transparency Smile)

protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = Request.UserAgent;
        }

And when we run the page and click on the button, by default IE9 would resort to IE9 Browser Mode and IE9 Document Mode

image

One of the nice things you would notice about the IE9 user agent string, is that, its simplified and doesn’t have the lengthy .NET Framework, CLR versions mentioned, as it was earlier.  Its simplified, much simplified!

When we change the browser mode to IE8, you will notice, couple of things

1. The page automatically reloads (not refresh)

2. The User Agent is as follows:-

image

Now, the main intent of this post, how can you test for other browsers

Open the F12, Developer Toolbar and from Tools – Change User Agent String

image

Lets say we select “Google Chrome”

image

and when we select “Opera”

image

Isn’t it cool, testing for Chrome/Opera/Firefox from within IE Toolbar? 

Cheers !!!

This article is part of the GWB Archives. Original Author: Harish Ranganathan

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.