Content deleted Content added
Synchretic (talk | contribs) |
Citation bot (talk | contribs) Removed parameters. | Use this bot. Report bugs. | #UCB_CommandLine |
||
(8 intermediate revisions by 7 users not shown) | |||
Line 1:
{{About|the web development technique|the neurological process|feature detection (nervous system)|the computer vision technique|feature detection (computer vision)}}
{{
'''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. This information is then used to make the application adapt in some way to suit the environment: to make use of certain [[API]]s, or tailor for a better user experience.<ref name=":0">{{
Its proponents claim it is more reliable and future-proof than other techniques like [[User agent#User agent sniffing|user agent sniffing]] and browser-specific CSS hacks.
==Techniques==
A feature test can take many forms. It is essentially ''any'' snippet of code which gives some level of confidence that a required feature is indeed supported. However, in contrast to other techniques, feature detection usually
As [[JavaScript]] is the most prevalent [[scripting language]] in web browsers{{Citation needed|date=March 2014}}, many feature detection techniques use JavaScript to inspect the [[Document Object Model|DOM]] and local JavaScript environment.
The simplest technique is to check for the existence of a relevant object or property. For example, the Geolocation API (used for accessing the
<nowiki>
Line 28:
When undetectables are encountered, it is common to turn to [[User agent#User agent sniffing|user agent sniffing]] as an alternative mechanism, or to employ [[defensive coding]] to minimise the impact if the feature turns out not to be supported.
The [[Modernizr]] project maintains a record of known undetectables on their [
==See also==
* [[Browser sniffing]]
* [[Progressive enhancement]]
* [[Modernizr]]
==References==
{{Reflist}}
[[Category:Web accessibility]]
|