The problem: you want to use HTML5 features or libraries on your site, but you also want to support older browsers. Fortunately there is a library called Modernizr to help. Because HTML5 is not simply one thing, it is not possible to simply detect HTML5 compatibility as a whole, and using browser specific checks is an archaic practice that is not a solid solution because some browsers do have partial HTML5 support which means those users would miss out on content regardless of browser support. Instead, the proper method is to detect support for specific features of HTML5. Modernizr makes this process easy.
An example of this would be HTML5 video. In order to use Modernizr to check for this it is very simple.
if ( Modernizr.video.webm )
// Try WebM
else if ( Modernizer.video.ogg )
// Try Ogg
else if ( Modernizr.video.h264 )
// Try H.264
// No HTML5 video supported, at this point you can use a flash player or another solution.
if ( Modernizr.video )
Modernizr works for many other HTML5 features as well miscellaneous things such as CSS3, geolocation, SVG, WebGL, and more. For more information and to download Modernizr, visit http://modernizr.com/.