判断浏览器大于等于ie9

方便自己查找
<script>
(function (window) {
var theUA = window.navigator.userAgent.toLowerCase();
if ((theUA.match(/msie\s\d+/) && theUA.match(/msie\s\d+/)[0]) || (theUA.match(/trident\s?\d+/) &&
theUA.match(/trident\s?\d+/)[0])) {
var ieVersion = theUA.match(/msie\s\d+/)[0].match(/\d+/)[0] || theUA.match(/trident\s?\d+/)[0];
if (ieVersion <= 9) {
console.log('浏览器小于IE9,请升级!')
} else {
//执行某些操作
return true
}
}
})(window);
</script>

猜你喜欢

转载自www.cnblogs.com/xiao-hui-hui/p/10275459.html
今日推荐