User:Sardisson/Gecko is Gecko: Difference between revisions

(→‎References: bz again)
 
Line 19: Line 19:


==“Runtime” Testing for Features==
==“Runtime” Testing for Features==
If for some reason this doesn’t work for your site or application—your site can “only” function with a particular user configuration or plug-in, for instance—test the user’s browser at “runtime” to see if it supports the required function or configuration parameters (also called “capability sniffing”).
If for some reason this doesn’t work for your site or application—your site can “only” function with a particular user configuration or plug-in, for instance—test the user’s browser at “runtime” to see if it supports the required function or configuration parameters (also called “capability sniffing” or “object detection”).


For example, [http://alistapart.com/articles/testdriven this ALA article] discusses methods of runtime testing of browser features to enable progressive enhancements in web pages.
For example, [http://alistapart.com/articles/testdriven this ALA article] discusses methods of runtime testing of browser features to enable progressive enhancements in web pages.
Line 25: Line 25:
[http://www.modernizr.com/ Modernizr] and [http://diveintohtml5.org/detect.html Detecting HTML5 Features] provide sample code and libraries for feature detection for parts of CSS3 and HTML5.
[http://www.modernizr.com/ Modernizr] and [http://diveintohtml5.org/detect.html Detecting HTML5 Features] provide sample code and libraries for feature detection for parts of CSS3 and HTML5.


'''Note:''' You should never test for the presence or absence of one feature and use the result of that test to deduce a rendering engine (or, worse, browser) and then assume a set of capabilities/supported features.  (This is little more than user-agent browser sniffing in sheep’s clothing, and it is susceptible to breakage when browsers change or remove features.)  '''Instead, you should always test for the presence of specific features you want to use;''' if they are present, you can use them.[http://weblogs.mozillazine.org/bz/archives/020913.html]
'''Note:''' You should never test for the presence or absence of one feature and use the result of that test to deduce a rendering engine (or, worse, browser) and then assume a set of capabilities/supported features based on your knowledge of the browser/rendering engine.  (This is little more than user-agent browser sniffing in sheep’s clothing, and it is susceptible to breakage when browsers add, change or remove features.)  '''Instead, you should always test for the presence of specific features you want to use;''' if they are present in a user’s browser, then you can use them.[http://weblogs.mozillazine.org/bz/archives/020692.html],[http://weblogs.mozillazine.org/bz/archives/020913.html]


==User-Agent Sniffing==
==User-Agent Sniffing==
124

edits