views:

151

answers:

1

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.

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

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?

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

http://stackoverflow.com/questions/1398962/why-does-jquery-browser-version-return-1-9-1-2-for-firefox-3-5-2

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.

+4  A: 

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
}
CalebD
+1 feature sniffing is always better than browser sniffing.
bobince
Works great! Thanks!
DA