Detecting IE8 reliably using javascript

advertisements

I have written a web app that requires IE version 8 (or higher presumably). If I run IE8 on a clean windows install on a VM it reports 'MSIE 8.0' as a user agent when queried with navigator.userAgent in javascript. But on a colleagues windows 7 machine his IE reports version 8 in the Help|About window, but the user agent string is 'MSIE 7.0'.

I figure that somewhere on his machine there is a setting that's telling IE to spoof the previous version, some kind of compatibility setting I presume, but for the life of me I can't find it. I'm not setting up quirksmode or IE7 compatibility mode from my end.


<meta http-equiv="X-UA-Compatible" content="IE=8">
<script type="text/javascript">
var is_ie8_or_newer = false;
</script>
<!--[if gte IE 8]>
<script type="text/javascript">
is_ie8_or_newer = true;
</script>
<![endif]-->