Just include this code in your JavaScript somewhere and get the version of IE just by referencing the ie
variable. The variable will return either a number (4-10) or undefined
.
alert(ie); // Alerts the IE version as an integer (4-10)
Microsoft deprecated their conditional comment support starting with IE 10. There is a specialized "hack" taking advantage of a specialized JavaScript conditional comment support language that allows us to do IE detection for version 10 that is built in, but that technique has not been tested with IE11. The nice thing is, it shouldn't be necessary there since Microsoft finally decided to take their heads out of the sand and start trying to play along with the rest of the internet with version 11.
alert(ie); // Alerts undefined
alert(ie); // Alerts undefined
if(ie){
// Do some stuff for poor IE users
} else {
// Do stuff for everyone else on the internet
}