Feature detection (also feature testing) is a technique used in web development for handling differences between runtime environments (typically web browsers or user agents), by programmatically testing for clues that the environment may or may not offer certain functionality.
[1] Its proponents claim it is more reliable and future-proof than other techniques like user agent sniffing and browser-specific CSS hacks.
It is essentially any snippet of code which gives some level of confidence that a required feature is indeed supported.
The simplest technique is to check for the existence of a relevant object or property.
For example, the Geolocation API (used for accessing the device's knowledge of its geographical location, possibly obtained from a GPS navigation device) exposes a geolocation property on the navigator object in the DOM; the presence of which implies the Geolocation API is supported: For a higher level of confidence, some feature tests will attempt to invoke the feature then look for clues that it behaved properly.