首页 > Web开发 > 详细

js判断浏览器

时间:2015-09-28 13:06:50      阅读:187      评论:0      收藏:0      [点我收藏+]

if (navigator.userAgent.indexOf("Opera") != -1) {
// document.write(‘您的浏览器是Opera吧?‘);
window.location.href = ‘/LoginMore.aspx‘;
}
// 包含「MSIE」文字列
else if (navigator.userAgent.indexOf("MSIE") != -1) {
// document.write(‘您的浏览器是Internet Explorer吧?‘);
window.location.href = ‘/Login.aspx‘;
}
else if (navigator.userAgent.indexOf(‘Trident‘) > -1 && navigator.userAgent.indexOf(‘rv:11‘) > -1) {
//alert(‘IE11‘);
window.location.href = ‘/Login.aspx‘;
} else if (navigator.userAgent.indexOf(‘MSIE‘) > -1 && navigator.userAgent.indexOf(‘Trident‘) > -1) {

// alert(‘IE8-10‘);
window.location.href = ‘/Login.aspx‘;
} else if (navigator.userAgent.indexOf(‘MSIE‘) > -1) {
//browser_name=‘IE(6-7)‘;
// alert(6 - 7);
window.location.href = ‘/Login.aspx‘;
}
// 包含「Firefox」文字列
else if (navigator.userAgent.indexOf("Firefox") != -1) {
// document.write(‘您的浏览器时Firefox吧?‘);
window.location.href = ‘/LoginMore.aspx‘;
}
// 包含「Netscape」文字列
else if (navigator.userAgent.indexOf("Netscape") != -1) {
// document.write(‘您的浏览器时Netscape吧?‘);
window.location.href = ‘/LoginMore.aspx‘;
}
// 包含「Safari」文字列
else if (navigator.userAgent.indexOf("Safari") != -1) {
// document.write(‘您的浏览器时Safari 吧?‘);
window.location.href = ‘/LoginMore.aspx‘;
}
else {
// document.write(‘无法识别的浏览器。‘);
window.location.href = ‘/LoginMore.aspx‘;
}

js判断浏览器

原文:http://www.cnblogs.com/zhangweixin/p/4843706.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!