Detect IE8 Compatibility Mode [duplicate]

IE8 includes a trident token in the User-Agent string regardless of compatibility mode.

See MSDN for more details: The Internet Explorer 8 User-Agent String (Updated Edition)

IE7 on Windows Vista
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)

IE8 on Windows Vista (Compatibility View)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)

IE8 on Windows Vista
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)

Leave a Comment