admin管理员组文章数量:1558061
对ie浏览器版本识别的js代码
// 判断是pc端还是还是手机
var theUA = window.navigator.userAgent.toLowerCase();
// 识别ie的
var theIE = navigator.userAgent.toLowerCase().match(/rv:([\d.]+)\) like gecko/)
// 对于是否是ie浏览器的判断
if(!+[1,]){
alert("这是ie浏览器")
}else{
alert("这不是ie浏览器");
}
// 实现检测IE浏览器版本ie10以及ie11版本的浏览器页面,版本太低给出提示,在index.heml里面的head添加
<script>
function getVendorPrefix() {
// 使用body是为了避免在还需要传入元素
var body = document.body || document.documentElement,
style = body.style,
vendor = ['webkit', 'khtml', 'moz', 'ms', 'o'],
i = 0;
while (i < vendor.length) {
// 此处进行判断是否有对应的内核前缀
if (typeof style[vendor[i] + 'Transition'] === 'string') {
return vendor[i];
}
i++;
}
}
if(getVendorPrefix()!='webkit'){
var str = "你的浏览器版本不适合本系统,请更换合适的浏览器版本!";
var str2 = "推荐使用:<a href='https://www.baidu/s?ie=UTF-8&wd=%E8%B0%B7%E6%AD%8C%E6%B5%8F%E8%A7%88%E5%99%A8' target='_blank' style='color:blue;'>谷歌</a>,"
+ "其他双核极速模式";
document.writeln("<pre style='text-align:center;color:#fff;background-color:cornflowerblue; height:100%;border:0;position:fixed;top:0;left:0;width:100%;z-index:1234'>" +
"<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
str2 + "</h2><h2 style='margin:0'><strong>如果你的使用的是双核浏览器,请切换到极速模式访问<br/></strong></h2></pre>");
document.execCommand("Stop");
// window.location.href("http://www3.firstjob/pros/jr/index.jsp")
}
</script>
版权声明:本文标题:对ie浏览器版本识别的js代码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727373029a1111393.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论