Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Feature detection (in this case, detecting support for conditional comments) is reliable as you know that a given version of a given browser has implemented a given feature in a certain way. Even if a later version removes this feature (in this case, conditional comments being dropped in IE10), it does not change how previous versions have implemented it. Likewise for a feature that wasn't implemented before and is later introduced in a newer version.</p> <p>When working with standards, feature detection is also often vendor-independent. You're looking at whether a feature is supported by the browser, regardless of what sort of browser it is. This helps facilitate interoperability between browsers, while avoiding unnecessary discrimination.</p> <p>On the other hand, when working with user agent strings, you're depending on the value of an arbitrary string that can be manipulated in all sorts of ways, not just by third parties or author code, but even by the user agent itself. This string is complex and difficult to parse, and often code that tries to parse it will fail in spectacular ways. That's what makes UA sniffing so unreliable.</p> <p><a href="http://www.modern.ie/en-us/cross-browser-best-practices" rel="nofollow">modern.IE</a> explains the downsides better:</p> <blockquote> <p><strong>Always prefer feature detection over browser (navigator.userAgent) detection.</strong><br> The userAgent string is a poor indicator of whether a particular feature (or bug) is present. To compound the problem, much of the code that interprets userAgent does so incorrectly. For example, one browser-sniffing library expected the major version to be only a single digit, so it reported Firefox 15 as Firefox 1 and IE 10 as IE 1! It is more reliable to <a href="http://msdn.microsoft.com/en-us/magazine/hh475813.aspx" rel="nofollow">detect the feature or problem directly</a>, and use that as the decision criteria for code branches. We recommend <a href="http://modernizr.com" rel="nofollow">Modernizr</a> as the easiest way to implement feature detection.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload