I had a conversation with one of the smartest developers I know yesterday over Twitter. She was looking for a tool that she could use to detect HTML5 features, only she wanted to detect these features server side, using PHP. A few months ago, I tried to build a Python library that would provide that service, however I ran into many problems. Eventually, I realized that the only reliable way to poll for available HTML5 features is to sniff out user agents.
The user agent approach to HTML5 feature detection is fraught with problems. But the biggest one was code quality and maintainability. Feature detection via user agent ultimately revolves around a whole lot of ‘if’ statements – if you use Chrome, these features are available; if you use Internet Explorer 9, these features are available and on and on. The problem with that is that HTML5 is a moving target – to keep that library maintained, I would need a team of people constantly monitoring changes in browsers and the degree of support that they provide.
This experience scared me off of HTML5 and, while I continue to work with it to make sure that my skills stay current, I refuse to use it on a production site. As I see it, working with HTML5 is the equivalent of going back in time to the days before Microsoft introduced the DOCTYPE declaration and trying to build a site. At that point, you literally had next to no way of controlling how your page would render on various browsers, so every page you built had to contain a litany of HTML hacks. Pre-doctype page source was ugly and difficult to maintain.