Why Browser Detection is Bad ?

Posted on by By Nikhilesh, in Front End, Javascript, Software Testing | 0

It is against the spirit of web standards

The whole reason that web standards exist is so that we don’t have to write specific code for specific environments. We should write code that adheres establishment of standards and software in charge of displaying our code should display it as the standards dictate.

It relies on the browser user-agent string,which has a hilariously disastrous history and it is easily spoofable. Also it can hinder devices

Example:

you detect for the iPhone and serve is special content. Now the iPhone can never see the web page as other browsers see it, despite it being fully capable of doing so.

why we do it?

We do it because different browsers handle things differently and browser detection can get us out of a pinch and get things working how they should.

sometimes the situations leading up to us resorting to browser-detection are rage-inducing. But remember it’s often not the browser that is at fault. Even in the case of IE 6, it was the most standards-compliant and advanced browser of it’s time when it was released. And some of the standards that we have today were not complete at that time.

What should we do instead?
Real-world web design sometimes needs quick fixes, and making damn sure features work as intended. This doesn’t always allow for altruistic choices that leave out some functionality because it is the “right thing to do.”

Ideally
we would do capability testing. That’s the information we really need right? Test if the environment we are in is capable of what we want to do. If it is, do it.

-By
Nitin Uttarwar
Helical It Solution

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments