So there are a lot of reasons I don’t like sniffing. Modernizr is a JavaScript library. It’s very small. The reason I love it is it checks for the capabilities. It doesn’t sniff for, “what user agent is this?” It says, “what is this user agent capable of?” And it’s very simple to use.
It requires a simple class on the HTML element and then you include the JavaScript. Here’s how it works. When the user surfs to your site they hit the site, Modernizr tests their browser very quickly and gives back a whole string of classes on your HTML element.