Using jquery.support to check for Firefox 3.5

孤街醉人 提交于 2019-12-08 10:05:12

问题


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:

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.


回答1:


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
}


来源:https://stackoverflow.com/questions/1958883/using-jquery-support-to-check-for-firefox-3-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!