js获取ie浏览器版本
<script>
var version = document.documentMode;
console.log('IE version: ' + version);
var userAgent = window.navigator.userAgent;
var version = parseInt(userAgent.substring(userAgent.indexOf('MSIE ') + 5, userAgent.indexOf('.', userAgent.indexOf('MSIE '))), 10);
console.log('userAgent:'+userAgent);
if (isNaN(version)) {
// 对于IE 11和其他现代浏览器,使用以下方法
var match = /Trident\/.*rv:(\d+.\d+)/.exec(userAgent);
if (match) {
version = parseFloat(match[1]);
}
}
console.log('Browser version: ' + version);
</script>
发表回复