Chapter 6. Feature Detection

There are a number of tools and frameworks available for testing your application. We have seen a number of them so far. We now move to more advanced concepts, which help us get a bug-free application. In this chapter, you will learn about feature detection for major browsers. While writing a piece of code in JavaScript, a developer often faces a question—will this code work on all browsers? Or at least, on popular browsers? Intention to write cross-browser code leads to feature detection.

The following topics will be covered in this chapter:

  • Understanding feature detection
  • has.js
  • Modernizr
  • Browser detection
  • Feature testing with Modernizr
  • Undetectable features

Understanding feature detection

Days are gone when there were simple ...

Get Test-Driven JavaScript Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.