Browser Capability Detection: You’re Doing It Wrong

Web developers (developers, developers): I need you to listen to me. Are you listening? Good. Stop trying to be smart about detecting browser capabilities. You almost always get this wrong. Usually it’s because you’re used to a single platform and only test on others and so you’re not always up to speed on how the various browsers of the world work.

There are two main scenarios in which you frequently fail hard, resulting in my assumption that you are a semi-professional entry-level developer at best. This makes me hate you. Often, it makes me fire off an angry rant to your contact address, chiding your lack of experience and your complete destruction of my faith in your site’s ability to be useful to me, even if I could find my way around your stupidity. Let’s explore these scenarios together that you might learn from them.

Mobile Versions – Whether You Want Them or Not

First, you assume based on my using “Mobile Safari” that I need to be railroaded to your “mobile version.” Many of you don’t even ask – you just shunt me to mobile and maybe, if I’m lucky, you give me the opportunity to view the “full site.” How generous. Some of you douche bags then fail to persist this choice so I have to go through the whole thing again the next time I visit (hint: there likely won’t be a next time). Then there are the rest of you. The assholes. The ones who classify visitors as “normal” or “mobile” and shove the “mobiles” bodily toward the “mobile version” without a choice.

I hate you. I hate you so much.

That might be alright for other mobile browsers (because they truly do suck), but not for my iOS device. I paid good money for great standards-compliant mobile browsing capabilities. Why the hell would you take that away from me for the simple crime of visiting your web site? Unless your site requires Flash (and it better fucking not), or mouse-overs (which is not compatible with our modern, growing, touch-based world), you have no reason whatsoever to force an iOS device to a “mobile version.” If I wanted some shitty, Y2K telephone web browsing experience, I’d shell out $500/month for 1.5 MB of download capacity for a Motorola RazR and download a low-fidelity Who Let the Dogs Out ring tone for $5.00.

I digress. If you must provide a mobile version in 2011, ask me up front if I want it and remember what I told you. A great mobile browsing experience on an iOS device has been available to users since 2007. You’ve had plenty of time to learn this so knock it the hell off.

Get a Real Browser

The other scenario involves “clever” JavaScript that decides either my whole web browser is “unsupported” (and refuses to let me in) or that I don’t have some plugin (that I often do) and doesn’t even try to do the right thing. This is just as idiotic as the “mobile version” scenario. These so-called web developers decide Safari (as a common example), which is standards-compliant and scores extremely high in this regard, just doesn’t work right and they won’t let you in if you’re using it. So many online banks did this until very recently (now only a few do it) for reasons completely unknown. Some of you assholes even go so far as to display a cheeky “get a real browser, LOLZ” message to users.

If you do this, what you’re really telling me is you’re completely incompetent as a web developer and I should be very wary of your site anyway because you clearly don’t know what you’re doing. If your site “doesn’t support” a modern, standards-compliant browser it’s your fault, not mine. It’s a bug and a goddamn big one. What you’re saying is “I’m a fuck-up, a miserable failure, and my site probably sucks even on my own browser of choice.”  You’re showing the world that you (and the company that hired you) are unprofessional, condescending jackasses who don’t deserve my business or readership because you’re either too lazy or too uninformed to build a proper web site. You tell me to get a real browser and I imagine you’re a high school aged relative of some clueless business owner who “wanted a web.” This isn’t the 1990s, folks. Hasn’t been for over a decade. Just having a web site – even a shitty one – won’t make you rich. These days it’ll just make you look like a moron.

So the real message isn’t “get a real browser” but rather “build a real goddamn web site.” It doesn’t have to be fancy. It just has to look nice and work no matter who visits it.

The other side of this is specific capability detection. You decide to employ your own “do they have Flash” routine. Ignoring the folly of reinventing the wheel many, many times (and doing it poorly almost every single time), it’s bad enough many of you decide to restrict capabilities rather than trying anyway and letting the user know “this may not work.”

These types of warnings should be informational. You should never ever restrict things on purpose based on your “clever” little JavaScript hack. Your goal should be to inform the user something seems like it may not work but try it anyway. To simply avoid trying to load a plugin because your detection mechanism failed to detect it will almost always end up mistakenly restricting a user. Real web developers’ sites degrade gracefully. They don’t fall flat on their faces, pissing and shitting themselves because their capability detection code (which often is never updated as browsers grow) was mistaken. It’s the same mindset as “Oh god, a big black man! He’s going to rob us!” It’s prejudice born of ignorance. Plain and simple.

If you do this you’re an inexperienced developer (and possibly racist). You may be an excellent graphic designer but you’re a shitty developer. Your goal should be standards compliance and graceful degradation (which is part of standards compliance but bad developers don’t seem to understand this), not trying to second-guess every possible scenario for every version of every browser. If you’re doing the latter, you’re doing it wrong and you’re pissing me off.

Rant Over

Okay, now that I’ve gotten that off my chest, here’s a message of hope: companies are beginning to realize how foolish it is to cut off entire browsers and platforms, and that there’s just no excuse for it these days. They see other companies’ sites – full, rich web applications – working just fine on all modern browsers. Hopefully this is sufficient pressure to force old-school (and newbie) developers to learn the modern state of the craft properly – to bring them out of the protective shell of their browser of choice and realize they must support all browsers. Cutting off a whole browser because [ pretty but useless effect ] isn’t supported is idiotic and detrimental to the goal of a web site: to draw in and retain repeat visitors.

Don’t be a douche bag web developer. You’ve got no excuse for it.