Right now, I'm doing this:
if (Function('/*@cc_on return document.documentMode===10@*/ ')()) {
// do stuff
}
But this only targets IE10. How to do it so I target IE10 and below? (Using the same pure JavaScript method?)
Right now, I'm doing this:
if (Function('/*@cc_on return document.documentMode===10@*/ ')()) {
// do stuff
}
But this only targets IE10. How to do it so I target IE10 and below? (Using the same pure JavaScript method?)
You can always parse UserAgent
string like the old times. Here are many examples that show you how.
function isIE () {
var myNav = navigator.userAgent.toLowerCase();
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
}
if (isIE () && isIE () < 9) {
// is IE version less than 9
} else {
// is IE 9 and later or not IE
}