04.11.2015 Views

javascript

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Client Detection<br />

Although browser vendors have made a concerted effort to implement common interfaces, the fact<br />

remains that each browser presents its own capabilities and flaws. Browsers that are available<br />

cross - platform often have different issues even though they are technically the same version. These<br />

differences force web developers to either design for the lowest common denominator or, more<br />

commonly, use various methods of client detection to work with or around limitations.<br />

Client detection remains one of the most controversial topics in web development. The idea that<br />

browsers should support a common set of functionality pervades most conversations on the topic.<br />

In an ideal world, this would be the case. In reality, however, there are enough browser differences<br />

and quirks that client detection becomes not just an afterthought, but also a vital part of the<br />

development strategy.<br />

There are several approaches to determine the web client being used, and each has advantages and<br />

disadvantages. It ’ s important to understand that client detection should be the very last step in<br />

solving a problem; whenever a more common solution is available, that solution should be used.<br />

Design for the most common solution first and then augment it with browser - specific solutions later.<br />

Capability Detection<br />

The most commonly used and widely accepted form of client detection is called capability detection .<br />

Capability detection (also called feature detection) aims not to identify a specific browser being<br />

used, but rather to identify the browser ’ s capabilities. This approach presumes that specific<br />

browser knowledge is unnecessary and that the solution may be found by determining if the<br />

capability in question actually exists. The basic pattern for capability detection is as follows:<br />

if (object.propertyInQuestion){<br />

//use object.propertyInQuestion<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!