browser detection not working with changing IE browser document mode

I have to include an additional js script for IE7.  I am using the IE7 developer tools to test different browsers.  If you open dev tools (press F12), then there is a tab where you can switch between IE9, 8, 7.  

No matter what this setting is on, I get the same info in C# using the function below.  (For some reason it always shows IE7.  When I try to find the version using JavaScript, I see the same version (9.0) no matter what the switch is on.

Question: How can I detect the browser and test using the IE document mode tab?

Output from js
console.log(navigator.userAgent);
LOG: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MS-RTC LM 8; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.2)

Open in new window


Output from C#
Browser Capabilities
Type = IE7
Name = IE
Version = 7.0
Major Version = 7
Minor Version = 0
Platform = WinNT
Is Beta = False
Is Crawler = False
Is AOL = False
Is Win16 = False
Is Win32 = True
Supports Frames = True
Supports Tables = True
Supports Cookies = True
Supports VBScript = True
Supports JavaScript = 1.2
Supports Java Applets = True
Supports ActiveX Controls = True

Open in new window


public string GetBrowserInfo()
{
    System.Web.HttpBrowserCapabilities browser = Request.Browser;
    string browserString = "Browser Capabilities<br>"
        + "Type = " + browser.Type + "<br>"
        + "Name = " + browser.Browser + "<br>"
        + "Version = " + browser.Version + "<br>"
        + "Major Version = " + browser.MajorVersion + "<br>"
        + "Minor Version = " + browser.MinorVersion + "<br>"
        + "Platform = " + browser.Platform + "<br>"
        + "Is Beta = " + browser.Beta + "<br>"
        + "Is Crawler = " + browser.Crawler + "<br>"
        + "Is AOL = " + browser.AOL + "<br>"
        + "Is Win16 = " + browser.Win16 + "<br>"
        + "Is Win32 = " + browser.Win32 + "<br>"
        + "Supports Frames = " + browser.Frames + "<br>"
        + "Supports Tables = " + browser.Tables + "<br>"
        + "Supports Cookies = " + browser.Cookies + "<br>"
        + "Supports VBScript = " + browser.VBScript + "<br>"
        + "Supports JavaScript = " +
            browser.EcmaScriptVersion.ToString() + "<br>"
        + "Supports Java Applets = " + browser.JavaApplets + "<br>"
        + "Supports ActiveX Controls = " + browser.ActiveXControls
                + "<br>";
    return browserString;
}

Open in new window

jackjohnson44Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jackjohnson44Author Commented:
I found the issue.  There are two buttons on the developer tools.  Browser Mode is sent to the server.  Document Mode is on the client.  If you change Browser Mode, you can detect it in C#, Document mode you can't.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.