I’ve written a web app that uses features that make it incompatible with IE and require minimum versions of Firefox and Chrome. To check browser compatibility, I’m getting the User-Agent from the headers of the request with web.py and checking the output with a simple regex.
I’m worried though, that changes to the way Chrome or Firefox declares it’s User-Agent might break my regex. Also, since I’m explicitly requiring Firefox or Chrome, I’m probably excluding some browsers that might otherwise be able to use the site.
Is checking User-Agent the right way to go? How should I go about checking compatibility to ensure only browsers that have sufficient functionality are served?
You’d better do it on client side, browser sniffing is considered bad. The best practice is using conditional comments to add ie# (Internet Explorer version) classname on html to be able to write separate css styles for it, and use modernizr to detect supported features.