How to detect if IE8 is running in compatibility view

browserdebugginginternet explorerinternet-explorer-8

Is there anyway to determine if an IE8 browser has compatibility view switched on?

I can't seem to find anything on Google, and so I'm wondering if this is a piece of information that is available…

Why you ask!? I'm trying to track down a bug in our application. I'm piecing through the Elmah logs and there seems to be a trend; this error is generally thrown by IE8. I tried to repo the defect in my copy of IE8, but couldn't. I want to narrow down the culprits, and thought this might be a way to do it.

Best Answer

In Javascript, use document.documentMode

See http://msdn.microsoft.com/en-us/library/cc196988%28VS.85%29.aspx for details.