Detect IE10 compatibility mode

ABC picture ABC · Feb 9, 2013 · Viewed 24.2k times · Source

I have some specific code paths for IE 10 and rest of the IE versions. If IE10 is running in compatibility mode, browser version is set to 7.0. Is there a way to detect if it is IE 10 irrespective of the standard/compatibility mode using JavaScript/JQuery?

Answer

Sergei Grebnov picture Sergei Grebnov · Feb 11, 2013

You can detect this using the navigator.userAgent string, for example

"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; InfoPath.3; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Zune 4.7)"

Trident/6.0 means IE10

MSIE 7.0 means compatibility mode

More details: https://stackoverflow.com/a/5825518/255654