function IETester(userAgent) {
var UA = userAgent || navigator.userAgent;
if (/msie/i.test(UA)) {
return UA.match(/msie (\d+\.\d+)/i)[1];
} else if (~UA.toLowerCase().indexOf('trident') && ~UA.indexOf('rv')) {
return UA.match(/rv:(\d+\.\d+)/)[1];
}
return false;
}
//console.log(IETester()); //不传参数返回当前IE版本,如果不是IE内核浏览器,返回false
if (IETester() == 8.0 || IETester() == 7.0 || IETester() == 6.0 || IETester() == 5.0) {
document.write("您的浏览器版本过低,建议升级");
if (confirm("您的浏览器版本过低,点击【确定】下载360浏览器,如不升级您将不能正常浏览网页!")) {
location.href = "https://browser.360.cn/ee/";
} else {
alert("您将退出网页!");
window.close();
//return false;
}
}
IETester('Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko');
网友评论