IE11の判別をJavascriptで行う
機会があったのでメモ
//IEのバージョンをかえす
function getIEVersion() {
var version,matches;
//IE11
if (-1 != navigator.userAgent.indexOf("rv:")) {
if (matches = navigator.appVersion.match(/rv: ([0-9]{1,})/)) {
version = matches[1];
}
}
//〜IE10
else if (-1 != navigator.userAgent.indexOf("MSIE")) {
if (matches = navigator.appVersion.match(/MSIE ([0-9]{1,})/)) {
version = matches[1];
}
}
//IE以外
else {
version = false;
}
return version;
}