使用jquery.support检查Firefox 3.5 [英] Using jquery.support to check for Firefox 3.5

查看:80
本文介绍了使用jquery.support检查Firefox 3.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用目前仅受Firefox 3.5支持的一些CSS(box-shadow:插图).对于所有其他浏览器,通过jQuery,我必须插入一些带有背景的div以完成效果.

I'd like to use some CSS that is only supported by Firefox 3.5 at the moment (box-shadow: inset). For all the other browsers, via jQuery, I'll have to insert some extra divs with backgrounds to accomplish the effect.

我想奖励" FF3.5用户,如果他们支持CSS,就不要再为那段脚本而烦恼了.

I'd like to 'reward' FF3.5 users and not bother with that bit of script if they support the CSS.

似乎通过jQuery测试浏览器的正确"方法是使用jQuery.support.但是,我看不到/不知道可以测试的任何特定功能对于Firefox 3.5而言是唯一的.有这样的事吗?

It seems that the 'proper' way to test for a browser via jQuery is to use jQuery.support. However, I don't see/know of any particular feature I could test for that would be unique to Firefox 3.5. Is there such a thing?

除非如此,否则我应该回退并使用jQuery.browser来获取呈现引擎的版本号,如下所示:

Barring that, should I just drop back and use jQuery.browser to get the rendering engine version number as shown here:

为什么JQuery.browser.version对于Firefox 3.5.2返回1.9.1.2

附录:我确实知道有jQuery的浏览器检测插件.如果真的真的很棒,我会考虑的,但是觉得加载一个插件以避免在FF3.5中运行额外的功能可能会达到目的.

ADDENDUM: I do know there are browser detect plugins for jQuery. If one is really, really great, I'd consider it, but feel that loading a plugin to avoid running an extra few functions in FF3.5 probably defeats the purpose.

推荐答案

这对我来说在Firefox 3.5中有效.它特定于Firefox(或更确切地说,是Gecko渲染引擎).

This works in Firefox 3.5 for me. It is specific to Firefox (or rather, the Gecko rendering engine).

if (typeof document.body.style.MozBoxShadow === 'string') {
// Do something
}

这篇关于使用jquery.support检查Firefox 3.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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