Get Internet Explorer (IE) Version


Hi,
We faced some CRM Issue based IE Version i.e some of the functionality was working fine in IE 8.0 and IE 9.0 but not working on IE 10.0 or later.. I had written the below function to detect the IE version and chage the logic accordingly.

function MSIEVersion() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf(“MSIE “)
var rv = ua.indexOf(“rv:”);
var compatible = ua.indexOf(“compatible”);
var ieVersion;

// If IE Version <= 10 and compatiable mode return version number
if ((msie > 0) && (rv == -1) && (compatible > 0))
{
ieVersion = parseInt(ua.substring(msie + 4, ua.indexOf(“.”, msie)));
if (ieVersion == 10)
{
ieVersion = ieVersion + 1;
}
return ieVersion;
}
// If IE Version <= 10 and not in compatiable mode return version number
if ((msie > 0) && (rv == -1) && (compatible == -1))
{
ieVersion = parseInt(ua.substring(msie + 4, ua.indexOf(“.”, msie)));

return ieVersion;
}
// If IE Version > 10, return version number
if ((msie == -1) && (rv > 0))
{

// If IE Version > 10
ieVersion = parseInt(ua.substring(rv + 3, ua.indexOf(“.”, rv + 5)));         r
eturn ieVersion;
}
}

Hope it helps..