Matt
Matt

Reputation: 4190

How do I determine the correct browser version when compatability mode is turned on

I need to determine which version of browser the user is using, however compatibility mode is turned on by default for the entire company.

On the server side script, how do I determine the real browser version?

Thanks

Update I've got my page correctly showing the IE version using document.documentMode, however I can't figure out how to pass this over to the server side so I can use it.

Upvotes: 6

Views: 9412

Answers (4)

NewUser
NewUser

Reputation: 1

Use HttpContext.Current.Request.UserAgent on server if on client then user navigator.userAgent and then instructions from below ie7 has no trident keyword but ie8 is trident/4 and IE5 is trident/5.

First look for MSIE x.x, if x.x is 7 then look for Trident/y.y. If trident is missing then it IE7 if y.y is 4 then its IE8 and if y.y is 5 then ie9 and if y.y is 6 then ie10

http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx

Upvotes: 0

ChrisLively
ChrisLively

Reputation: 88072

Rather than fighting compatibility mode, you can turn it off for your specific web application. We do this on all of our sites because compatibility mode really screws a lot of things up.

Force IE compatibility mode off using tags

Upvotes: 0

Matt
Matt

Reputation: 4190

document.documentMode in javascript was the solution.

<script>
alert(document.documentMode);
<script>

Upvotes: 2

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Request.Browser will give you complete browser information, where you can check version, browser name, browser type etc.

Request.Browser.Version // Return complete browser version infor
Request.Browser.Browser // If browser is IE then it will return **IE**

Upvotes: 4

Related Questions