JavaScript returning wrong IE version
I have a small Ja开发者_Python百科vaScript function that is supposed to return the IE version.
Problem is, when I publish and view the site this function is returning 7.
I am viewing the site with IE 8.0.7600.16385.
What's going on?
function getIEVersionNumber() {
var ua = navigator.userAgent;
var MSIEOffset = ua.indexOf("MSIE ");
if (MSIEOffset == -1) {
return 0;
} else {
return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
}
}
Maybe your browser is running in IE 7 compatible mode?
精彩评论