【问题标题】:Browser detection versus capability detection for IE 6 select / z-index bugIE 6 选择/z-index 错误的浏览器检测与功能检测
【发布时间】:2010-11-11 19:30:14
【问题描述】:

我编写了一个 jquery 插件,它在将鼠标悬停在一个元素上时会弹出一个 div 部分,我需要处理 IE6 中的“选择 z-index”错误 (http://blogs.msdn.com/ie/archive/2006/01/17/514076.aspx)。因此,如果在 IE6 中运行,我的代码需要在页面上隐藏一些选择框,当弹出的 div 可见时。

我的问题是:在尝试遵循最佳实践时,我想避免检测实际的浏览器版本,而是进行“功能测试”,以确定我是否在受影响的浏览器中。(http://ejohn.org/blog/future-proofing-javascript-libraries)。有什么办法吗?或者我应该把它当作特例,检测浏览器并处理IE6?

【问题讨论】:

    标签: javascript internet-explorer-6


    【解决方案1】:

    我一直使用这个 sn-p。这很酷,因为它只检查 IE6。但请注意,如果您使用任何删除 HTML cmets 的代码压缩工具,这将不起作用。

    <!-- THESE LINES ARE NOT NORMAL HTML COMMENTS! They are instructions that only IE6 can understand. -->
    <!--[if IE 6]>
        <script type="text/javascript">
            // redirect to the Default error page passing a custom error code.
            window.location = '/your/redirect/page';
        </script>
    

    干杯。

    【讨论】:

      【解决方案2】:

      使用bgiframe plugin 修复错误,无需隐藏页面上的选择框。

      【讨论】:

        猜你喜欢
        • 2014-08-03
        • 1970-01-01
        • 2012-01-20
        • 2019-02-10
        • 2010-11-20
        • 1970-01-01
        • 2011-03-26
        相关资源
        最近更新 更多