Is there a better way then using jQuery.browser, or equivalents, for determining css 3 prefixes (-moz, -webkit, etc), as it is disencouraged? Since the css is dynamic (the user can do anything with it on runtime), css hacks and style tag hacks can’t be considered.
Is there a better way then using jQuery.browser , or equivalents , for determining
Share
I don’t see the issue with using the
navigator.userAgentto determine if you need to cater for Webkit / Gecko CSS3 prefixes. Or better yet, just stick with CSS2 until CSS3 becomes a W3C Recommendation.The reason use of the
navigatorobject is discouraged is because it was used over Object detection when (java)scripting for different browsers, your situation is one where it is fine to use user agent detection, because your’e specifically targeting certain quirks with different rendering engines.Edit:
Picking up from where cy left off, you can use javascript object detection to detect whether a prefix is used, I made some quick code to do so:
Remember to watch out for strange quirks such as
-moz-opacitywhich is only supported in older versions of Firefox but has now been deprecated in favour ofopacity, while it still uses the-moz-prefix for other new CSS3 styles.