IE浏览器对IE6浏览器检测显示为真 [英] some none IE browsers are showing true for IE6 Browser detection

查看:87
本文介绍了IE浏览器对IE6浏览器检测显示为真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在运行jQuery 1.3.2(是的,它已经很旧了,现在我无法升级).

So I'm running jQuery 1.3.2 (yep it's old and right now I can't upgrade).

问题是我正在尝试放弃对我们内部网站的IE6支持并升级浏览器.我有这张支票

Problem is I'm trying to drop IE6 support for our internal site and upgrade the browser. I have this check

if($.browser.msie && $.browser.version=="6.0") {
    // do something...
}

但是在测试期间(某些)Firefox用户正在看到do something条件,应该不会.以下是一些我认为可能导致此问题的用户代理.

But during testing (some) Firefox users are seeing the do something condition and should'nt be. Here are some of the User Agents that I think might be causing the issue.

  • UserAgent:Mozilla/5.0(Windows NT 6.1; WOW64)AppleWebKit/535.7(KHTML,例如Gecko)Chrome/16.0.912.75 Safari/535.7
  • UserAgent:Mozilla/5.0(Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.23)Gecko/20110920 Firefox/3.6.23
  • UserAgent:Mozilla/5.0(Windows NT 5.1)AppleWebKit/535.7(KHTML,例如Gecko)Chrome/16.0.912.75 Safari/535.7
  • UserAgent:Mozilla/5.0(Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25)Gecko/20111212 Firefox/3.6.25
  • UserAgent:Mozilla/5.0(Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.12)Gecko/20101026 Firefox/3.6.12

我需要更多的IE6验证吗?

Is there more IE6 validation I need?

注意:最终用户未安装任何加载项.我在想像IE-Tabs这样的问题可能会导致问题,但事实并非如此

Note: The end user has no add-ons installed. I was thinking something like IE-Tabs could cause the issue but that's not the case

更新:

下面所有的回答都使我想到了这一点,尽管仍在测试中,但看起来不错.有什么改进的方法吗?

All of the responses below lead me to this, still testing but it looks good. Any thoughs on how to improve it?

var ie6 = $.browser.msie && parseInt($.browser.version) === 6 && typeof window['XMLHttpRequest'] !== "object";
if(typeof document.body.style.maxHeight === "undefined" && ie6) {
    alert('Your browser is IE6');
}

相关问题:

  • jQuery detect IE6 using jQuery.support NOT jQuery.browser
  • Detecting IE6 using jQuery.support

推荐答案

感谢所有人帮助我找到了想要的东西,也许这可能会对其他人有所帮助

Thanks all to helped me find what I was looking for, maybe this might help others

var ie6 = $.browser.msie && parseInt($.browser.version) === 6 && typeof window['XMLHttpRequest'] !== "object";
if(typeof document.body.style.maxHeight === "undefined" && ie6) {
    alert('Your browser is IE6');
}

这篇关于IE浏览器对IE6浏览器检测显示为真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆